(unstable) pushing WIP
This commit is contained in:
@@ -17,6 +17,7 @@ fn hv_to_rhai<T>(r: Result<T, cloudhv::CloudHvError>) -> Result<T, Box<EvalAltRe
|
||||
fn map_to_vmspec(spec: Map) -> Result<VmSpec, Box<EvalAltResult>> {
|
||||
let id = must_get_string(&spec, "id")?;
|
||||
let kernel_path = get_string(&spec, "kernel_path");
|
||||
let initramfs_path = get_string(&spec, "initramfs_path");
|
||||
let firmware_path = get_string(&spec, "firmware_path");
|
||||
let disk_path = must_get_string(&spec, "disk_path")?;
|
||||
let api_socket = get_string(&spec, "api_socket").unwrap_or_else(|| "".to_string());
|
||||
@@ -28,6 +29,7 @@ fn map_to_vmspec(spec: Map) -> Result<VmSpec, Box<EvalAltResult>> {
|
||||
Ok(VmSpec {
|
||||
id,
|
||||
kernel_path,
|
||||
initramfs_path,
|
||||
firmware_path,
|
||||
disk_path,
|
||||
api_socket,
|
||||
@@ -46,6 +48,11 @@ fn vmspec_to_map(s: &VmSpec) -> Map {
|
||||
} else {
|
||||
m.insert("kernel_path".into(), Dynamic::UNIT);
|
||||
}
|
||||
if let Some(ir) = &s.initramfs_path {
|
||||
m.insert("initramfs_path".into(), ir.clone().into());
|
||||
} else {
|
||||
m.insert("initramfs_path".into(), Dynamic::UNIT);
|
||||
}
|
||||
if let Some(fw) = &s.firmware_path {
|
||||
m.insert("firmware_path".into(), fw.clone().into());
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user