Skip to content

Commit

Permalink
chore(NODE-1474): remove unnecessary setupos_tool GenerateMacAddress …
Browse files Browse the repository at this point in the history
…command (#1564)

GenerateMacAddress command is not used in SetupOS.
  • Loading branch information
andrewbattat authored Sep 18, 2024
1 parent 4e8565c commit 0441f40
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions rs/ic_os/os_tools/setupos_tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use config::{DEFAULT_SETUPOS_CONFIG_INI_FILE_PATH, DEFAULT_SETUPOS_DEPLOYMENT_JS
use network::generate_network_config;
use network::info::NetworkInfo;
use network::ipv6::generate_ipv6_address;
use network::mac_address::{generate_mac_address, FormattedMacAddress};
use network::mac_address::generate_mac_address;
use network::node_type::NodeType;
use network::systemd::DEFAULT_SYSTEMD_NETWORK_DIR;
use utils::to_cidr;
Expand All @@ -22,10 +22,6 @@ pub enum Commands {
/// systemd-networkd output directory
output_directory: String,
},
GenerateMacAddress {
#[arg(short, long, default_value = "SetupOS")]
node_type: String,
},
GenerateIpv6Address {
#[arg(short, long, default_value = "SetupOS")]
node_type: String,
Expand Down Expand Up @@ -110,28 +106,6 @@ pub fn main() -> Result<()> {
println!("{}", to_cidr(ipv6_address, network_info.ipv6_subnet));
Ok(())
}
Some(Commands::GenerateMacAddress { node_type }) => {
let config_map = config_map_from_path(Path::new(&opts.config))
.context("Please specify a valid config file with '--config'")?;
eprintln!("Using config: {:?}", config_map);

let network_info = NetworkInfo::from_config_map(&config_map)?;
eprintln!("Network info config: {:?}", &network_info);

let deployment_settings = get_deployment_settings(Path::new(&opts.deployment_file))
.context("Please specify a valid deployment file with '--deployment-file'")?;
eprintln!("Deployment config: {:?}", deployment_settings);

let node_type = node_type.parse::<NodeType>()?;
let mac = generate_mac_address(
&deployment_settings.deployment.name,
&node_type,
deployment_settings.deployment.mgmt_mac.as_deref(),
)?;
let mac = FormattedMacAddress::from(&mac);
println!("{}", mac.get());
Ok(())
}
None => Err(anyhow!(
"No subcommand specified. Run with '--help' for subcommands"
)),
Expand Down

0 comments on commit 0441f40

Please sign in to comment.