CLI help, comments & messages: make clear that full-length node ID = public key #688

Merged
lx merged 1 commit from rename-public-key into main 2024-01-16 13:33:44 +00:00
5 changed files with 11 additions and 10 deletions
Showing only changes of commit 82a29bf6e5 - Show all commits

View file

@ -43,7 +43,7 @@ pub fn node_id_command(config_file: PathBuf, quiet: bool) -> Result<(), Error> {
idstr idstr
); );
eprintln!( eprintln!(
"where <remote_node> is their own node identifier in the format: <pubkey>@<ip>:<port>" "where <remote_node> is their own node identifier in the format: <full-node-id>@<ip>:<port>"
); );
eprintln!(); eprintln!();
eprintln!("This node identifier can also be added as a bootstrap node in other node's garage.toml files:"); eprintln!("This node identifier can also be added as a bootstrap node in other node's garage.toml files:");

View file

@ -64,7 +64,8 @@ pub enum Command {
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub enum NodeOperation { pub enum NodeOperation {
/// Print identifier (public key) of this Garage node /// Print the full node ID (public key) of this Garage node, and its publicly reachable IP
/// address and port if they are specified in config file under `rpc_public_addr`
#[structopt(name = "id", version = garage_version())] #[structopt(name = "id", version = garage_version())]
NodeId(NodeIdOpt), NodeId(NodeIdOpt),
@ -82,8 +83,9 @@ pub struct NodeIdOpt {
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub struct ConnectNodeOpt { pub struct ConnectNodeOpt {
/// Node public key and address, in the format: /// Full node ID (public key) and IP address and port, in the format:
/// `<public key hexadecimal>@<ip or hostname>:<port>` /// `<full node ID>@<ip or hostname>:<port>`.
/// You can retrieve this information on the target node using `garage node id`.
pub(crate) node: String, pub(crate) node: String,
} }

View file

@ -46,8 +46,7 @@ use secrets::Secrets;
about = "S3-compatible object store for self-hosted geo-distributed deployments" about = "S3-compatible object store for self-hosted geo-distributed deployments"
)] )]
struct Opt { struct Opt {
/// Host to connect to for admin operations, in the format: /// Host to connect to for admin operations, in the format: <full-node-id>@<ip>:<port>
/// <public-key>@<ip>:<port>
#[structopt(short = "h", long = "rpc-host", env = "GARAGE_RPC_HOST")] #[structopt(short = "h", long = "rpc-host", env = "GARAGE_RPC_HOST")]
pub rpc_host: Option<String>, pub rpc_host: Option<String>,
@ -201,7 +200,7 @@ async fn cli_command(opt: Opt) -> Result<(), Error> {
// Find and parse the address of the target host // Find and parse the address of the target host
let (id, addr, is_default_addr) = if let Some(h) = opt.rpc_host { let (id, addr, is_default_addr) = if let Some(h) = opt.rpc_host {
let (id, addrs) = parse_and_resolve_peer_addr(&h).ok_or_else(|| format!("Invalid RPC remote node identifier: {}. Expected format is <pubkey>@<IP or hostname>:<port>.", h))?; let (id, addrs) = parse_and_resolve_peer_addr(&h).ok_or_else(|| format!("Invalid RPC remote node identifier: {}. Expected format is <full node id>@<IP or hostname>:<port>.", h))?;
(id, addrs[0], false) (id, addrs[0], false)
} else { } else {
let node_id = garage_rpc::system::read_node_id(&config.as_ref().unwrap().metadata_dir) let node_id = garage_rpc::system::read_node_id(&config.as_ref().unwrap().metadata_dir)
@ -231,7 +230,7 @@ async fn cli_command(opt: Opt) -> Result<(), Error> {
addr addr
); );
} }
Err(e).err_context("Unable to connect to destination RPC host. Check that you are using the same value of rpc_secret as them, and that you have their correct public key.")?; Err(e).err_context("Unable to connect to destination RPC host. Check that you are using the same value of rpc_secret as them, and that you have their correct full-length node ID (public key).")?;
} }
let system_rpc_endpoint = netapp.endpoint::<SystemRpc, ()>(SYSTEM_RPC_PATH.into()); let system_rpc_endpoint = netapp.endpoint::<SystemRpc, ()>(SYSTEM_RPC_PATH.into());

View file

@ -148,7 +148,7 @@ impl ConsulDiscovery {
ret.push((pubkey, SocketAddr::new(ip, ent.service_port))); ret.push((pubkey, SocketAddr::new(ip, ent.service_port)));
} else { } else {
warn!( warn!(
"Could not process node spec from Consul: {:?} (invalid IP or public key)", "Could not process node spec from Consul: {:?} (invalid IP address or node ID/pubkey)",
ent ent
); );
} }

View file

@ -57,7 +57,7 @@ pub const SYSTEM_RPC_PATH: &str = "garage_rpc/membership.rs/SystemRpc";
pub enum SystemRpc { pub enum SystemRpc {
/// Response to successfull advertisements /// Response to successfull advertisements
Ok, Ok,
/// Request to connect to a specific node (in <pubkey>@<host>:<port> format) /// Request to connect to a specific node (in <pubkey>@<host>:<port> format, pubkey = full-length node ID)
Connect(String), Connect(String),
/// Ask other node its cluster layout. Answered with AdvertiseClusterLayout /// Ask other node its cluster layout. Answered with AdvertiseClusterLayout
PullClusterLayout, PullClusterLayout,