fixed panicking code on main:50
This commit is contained in:
parent
b85feef0ab
commit
80e899dd37
@ -9,7 +9,6 @@ use crate::state::UpdateVMReq;
|
||||
use std::fs::read_dir;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
let config = Config::load_from_disk(crate::constants::DAEMON_CONFIG_PATH)?;
|
||||
let mut res = match state::Resources::load_from_disk() {
|
||||
Ok(res) => res,
|
||||
@ -47,7 +46,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
if path.is_file() {
|
||||
let new_vm_req = UpdateVMReq::from_file(&args[1])?;
|
||||
let new_vm_req = UpdateVMReq::from_file(path.to_str().unwrap())?;
|
||||
let content = std::fs::read_to_string(crate::constants::VM_CONFIG_DIR.to_string() + &new_vm_req.uuid + ".yaml")?;
|
||||
let mut vm: crate::state::VM = serde_yaml::from_str(&content)?;
|
||||
vm.update(new_vm_req, &config, &mut res).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user