1
0
mirror of https://github.com/tonarino/innernet.git synced 2024-11-28 08:58:37 +02:00

client: fix add-cidr when confirm is 'no'

This commit is contained in:
Jake McGinty 2021-05-21 13:00:09 +09:00
parent ff0527d836
commit a140786d53

View File

@ -544,22 +544,24 @@ fn add_cidr(interface: &InterfaceName, opts: AddCidrOpts) -> Result<(), Error> {
let api = Api::new(&server); let api = Api::new(&server);
let cidrs: Vec<Cidr> = api.http("GET", "/admin/cidrs")?; let cidrs: Vec<Cidr> = api.http("GET", "/admin/cidrs")?;
let cidr_request = prompts::add_cidr(&cidrs, &opts)?; if let Some(cidr_request) = prompts::add_cidr(&cidrs, &opts)? {
log::info!("Creating CIDR...");
let cidr: Cidr = api.http_form("POST", "/admin/cidrs", cidr_request)?;
log::info!("Creating CIDR..."); eprintdoc!(
let cidr: Cidr = api.http_form("POST", "/admin/cidrs", cidr_request)?; "
CIDR \"{cidr_name}\" added.
eprintdoc!( Right now, peers within {cidr_name} can only see peers in the same CIDR
" , and in the special \"infra\" CIDR that includes the innernet server peer.
CIDR \"{cidr_name}\" added.
Right now, peers within {cidr_name} can only see peers in the same CIDR You'll need to add more associations for peers in diffent CIDRs to communicate.
, and in the special \"infra\" CIDR that includes the innernet server peer. ",
cidr_name = cidr.name.bold()
You'll need to add more associations for peers in diffent CIDRs to communicate. );
", } else {
cidr_name = cidr.name.bold() log::info!("exited without creating CIDR.");
); }
Ok(()) Ok(())
} }