mirror of
https://gitlab.com/fabinfra/fabaccess/sute.git
synced 2025-03-12 14:41:52 +01:00
Status commit
This commit is contained in:
parent
6913602595
commit
a6d4bc06de
2
schema
2
schema
@ -1 +1 @@
|
|||||||
Subproject commit d930c70978e8bd5b28b9c19c907d2fe457797a89
|
Subproject commit 1dc6781a26af42312acefa6981d3cac2aa1345d6
|
21
src/app.rs
21
src/app.rs
@ -119,6 +119,27 @@ impl<'a, S: Unpin> Sute<'a, S> {
|
|||||||
error!(self.log, "minfo <uid>")
|
error!(self.log, "minfo <uid>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some(("list", _m)) => {
|
||||||
|
if let Some(mut machines) = self.session.as_mut().map(|s| s.bootstrap.machines()) {
|
||||||
|
let log = self.log.clone();
|
||||||
|
|
||||||
|
let f = async move {
|
||||||
|
let machlist = machines.await.list_machines().await;
|
||||||
|
info!(log, "Listing all machines");
|
||||||
|
for m in machlist {
|
||||||
|
m.get_info().map(|info| {
|
||||||
|
info!(log, "A machine: {:?}", info);
|
||||||
|
}).await;
|
||||||
|
}
|
||||||
|
info!(log, "Listed all machines");
|
||||||
|
};
|
||||||
|
|
||||||
|
let old_f = self.future.replace(Box::pin(f.map(|_| ())));
|
||||||
|
if !old_f.is_none() {
|
||||||
|
warn!(self.log, "Dropping a future");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
Some((s, m)) => info!(self.log, "Got Command {} with params {:?}", s, m),
|
Some((s, m)) => info!(self.log, "Got Command {} with params {:?}", s, m),
|
||||||
None => error!(self.log, "No command provided."),
|
None => error!(self.log, "No command provided."),
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ impl<'help> CommandParser<'help> {
|
|||||||
.subcommand(App::new("minfo")
|
.subcommand(App::new("minfo")
|
||||||
.arg(Arg::new("uid")
|
.arg(Arg::new("uid")
|
||||||
.takes_value(true)))
|
.takes_value(true)))
|
||||||
|
.subcommand(App::new("list"))
|
||||||
,
|
,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,28 @@ impl Machines {
|
|||||||
None
|
None
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn list_machines(&mut self) -> impl Future<Output=Vec<Machine>> {
|
||||||
|
let req = self.inner.list_machines_request();
|
||||||
|
let promise = req.send().promise;
|
||||||
|
|
||||||
|
promise.map(|res| {
|
||||||
|
let tmp = res.unwrap();
|
||||||
|
let moretmp = tmp.get().unwrap();
|
||||||
|
let mut out = Vec::new();
|
||||||
|
if let Ok(m) = moretmp.get_machines() {
|
||||||
|
for machine in m.iter() {
|
||||||
|
match machine.get_read() {
|
||||||
|
Ok(read) => out.push(Machine::new(read)),
|
||||||
|
Err(e) => println!("{}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("No get_machines? :(")
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uuid_from_api(uuid: crate::schema::api_capnp::u_u_i_d::Reader) -> Uuid {
|
pub fn uuid_from_api(uuid: crate::schema::api_capnp::u_u_i_d::Reader) -> Uuid {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user