Skip to content

Commit

Permalink
respond to John's comments on 5685
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed May 4, 2024
1 parent 0c673f6 commit dc3dde7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion wicket-common/src/rack_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl<T: fmt::Display> fmt::Display for DisplaySlice<'_, T> {
/// Describes the actual authentication key to use with a BGP peer.
///
/// Currently, only TCP-MD5 authentication is supported.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum BgpAuthKey {
/// TCP-MD5 authentication.
Expand All @@ -358,6 +358,17 @@ impl BgpAuthKey {
}
}

// Ensure that the key is not displayed in debug output.
impl fmt::Debug for BgpAuthKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
BgpAuthKey::TcpMd5 { key: _ } => {
f.debug_struct("TcpMd5").field("key", &"********").finish()
}
}
}
}

/// Describes insensitive information about a BGP authentication key.
///
/// This information is considered okay to display in the UI.
Expand Down
3 changes: 1 addition & 2 deletions wicket/src/cli/rack_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,7 @@ impl SetBgpAuthKeyArgs {
};

eprintln!(
"\nsetting {} {} to use {} authentication \
(press Ctrl-C to cancel)",
"\nsetting {} {} to use {} authentication",
display_count.style(styles.bold),
keys_str(len),
self.auth_method.style(styles.bold),
Expand Down

0 comments on commit dc3dde7

Please sign in to comment.