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:
parent
ff0527d836
commit
a140786d53
@ -544,8 +544,7 @@ 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...");
|
log::info!("Creating CIDR...");
|
||||||
let cidr: Cidr = api.http_form("POST", "/admin/cidrs", cidr_request)?;
|
let cidr: Cidr = api.http_form("POST", "/admin/cidrs", cidr_request)?;
|
||||||
|
|
||||||
@ -560,6 +559,9 @@ fn add_cidr(interface: &InterfaceName, opts: AddCidrOpts) -> Result<(), Error> {
|
|||||||
",
|
",
|
||||||
cidr_name = cidr.name.bold()
|
cidr_name = cidr.name.bold()
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
log::info!("exited without creating CIDR.");
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user