Skip to content

Commit

Permalink
Removed DashboardBackendClient from CLI (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrodimarco-dfinity authored Jun 28, 2024
1 parent 39f1b87 commit 4cc49d3
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 485 deletions.
146 changes: 0 additions & 146 deletions rs/cli/src/clients.rs

This file was deleted.

11 changes: 0 additions & 11 deletions rs/cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod cli;
pub mod clients;
pub(crate) mod defaults;
pub mod detect_neuron;
pub mod general;
Expand All @@ -9,13 +8,3 @@ pub mod ops_subnet_node_replace;
pub mod parsed_cli;
pub mod registry_dump;
pub mod runner;

/// Get a localhost socket address with random, unused port.
pub fn local_unused_port() -> u16 {
let addr: std::net::SocketAddr = "127.0.0.1:0".parse().unwrap();
let socket = socket2::Socket::new(socket2::Domain::IPV4, socket2::Type::STREAM, Some(socket2::Protocol::TCP)).unwrap();
socket.bind(&addr.into()).unwrap();
socket.set_reuse_address(true).unwrap();
let tcp = std::net::TcpListener::from(socket);
tcp.local_addr().unwrap().port()
}
14 changes: 6 additions & 8 deletions rs/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::ic_admin::IcAdminWrapper;
use clap::{error::ErrorKind, CommandFactory, Parser};
use decentralization::subnets::NodesRemover;
use decentralization::subnets::{MembershipReplace, NodesRemover, ReplaceTarget};
use dotenv::dotenv;
use dre::cli::proposals::ProposalStatus;
use dre::detect_neuron::Auth;
Expand Down Expand Up @@ -80,7 +80,7 @@ async fn main() -> Result<(), anyhow::Error> {
.await
.expect("Failed to create a runner");

let r = match &cli_opts.subcommand {
match &cli_opts.subcommand {
// Covered above
cli::Commands::Upgrade => Ok(()),
cli::Commands::DerToPrincipal { path } => {
Expand Down Expand Up @@ -139,12 +139,12 @@ async fn main() -> Result<(), anyhow::Error> {
let min_nakamoto_coefficients = parse_min_nakamoto_coefficients(&mut cmd, min_nakamoto_coefficients);
runner_instance
.membership_replace(
ic_management_types::requests::MembershipReplaceRequest {
MembershipReplace {
target: match &subnet.id {
Some(subnet) => ic_management_types::requests::ReplaceTarget::Subnet(*subnet),
Some(subnet) => ReplaceTarget::Subnet(*subnet),
None => {
if let Some(motivation) = motivation.clone() {
ic_management_types::requests::ReplaceTarget::Nodes {
ReplaceTarget::Nodes {
nodes: nodes.clone(),
motivation,
}
Expand Down Expand Up @@ -551,9 +551,7 @@ async fn main() -> Result<(), anyhow::Error> {
};
}
},
};
let _ = runner_instance.stop_backend().await;
r
}
})
.await;

Expand Down
Loading

0 comments on commit 4cc49d3

Please sign in to comment.