bulk_upload.inner_mut().set_timeout(Some(UPLOAD_TIMEOUT));
let uploaded = upload.bulk(bulk_upload, size,
&hash, progress, &mut for_response)?;
- {
+ let bundle = {
let gref = Instance::lookup_by_name(&game, auth)?;
let mut bundles = gref.lock_bundles();
let mut ig = gref.lock()?;
- bundles.finish_upload(&mut ig, uploaded)?;
+ bundles.finish_upload(&mut ig, uploaded)?
};
- Fine
+ MR::Bundle { bundle }
}
MC::ListBundles { game } => {
let (ag, gref) = start_access_game(&game)?;
progress: MgmtChannel::PROGRESS,
};
let mut progress = termprogress::new();
- chan.cmd_withbulk(&cmd, &mut f, &mut io::sink(), &mut *progress)?;
+ let resp = chan.cmd_withbulk(&cmd, &mut f, &mut io::sink(),
+ &mut *progress)?;
+ if_let!{ MR::Bundle { bundle } = resp;
+ else throw!(anyhow!("unexpected {:?}", &resp)) };
+ progress.clear();
+ println!("{}", bundle);
}
inventory::submit!{Subcommand(
impl InstanceBundles {
#[throws(MgmtError)]
pub fn finish_upload(&mut self, ig: &mut Instance,
- Uploaded { id, parsed }: Uploaded) {
+ Uploaded { id, parsed }: Uploaded) -> Id {
let tmp = id.path_tmp(&ig.name);
let install = id.path_(&ig.name);
}
ref x => panic!("unexpected {:?}", x),
};
+ id
}
}
Libraries(Vec<LibraryEnquiryData>),
LibraryItems(Vec<ItemEnquiryData>),
Bundles { bundles: MgmtBundleList },
+ Bundle { bundle: bundles::Id },
}
pub type MgmtBundleList = BTreeMap<bundles::Id, bundles::State>;
match &resp {
Progress(_) => panic!(),
Fine | AccountsList{..} | GamesList{..} |
- Libraries(_) | LibraryItems(_) | Bundles{..} => { },
+ Libraries(_) | LibraryItems(_) | Bundles{..} | Bundle{..} => { },
AlterGame { error: None, .. } => { },
Error { error } => {
Err(error.clone()).context(