]> git.proxmox.com Git - proxmox-backup.git/commitdiff
remove useless command option from daemons
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 31 Jan 2019 13:28:00 +0000 (14:28 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 1 Feb 2019 09:41:54 +0000 (10:41 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/bin/proxmox-backup-api.rs
src/bin/proxmox-backup-proxy.rs

index ba9d3029d6d2cfebf38b82d055410b453336edfc..e572434a8def572d071cc629f95a82a7adf8d8b3 100644 (file)
@@ -1,13 +1,9 @@
 extern crate proxmox_backup;
 
-use std::sync::Arc;
-
 //use proxmox_backup::tools;
-use proxmox_backup::api::schema::*;
 use proxmox_backup::api::router::*;
 use proxmox_backup::api::config::*;
 use proxmox_backup::server::rest::*;
-use proxmox_backup::getopts;
 use proxmox_backup::auth_helpers::*;
 
 use lazy_static::lazy_static;
@@ -38,53 +34,6 @@ fn main() {
     }
     let _ = csrf_secret(); // load with lazy_static
 
-    let command : Arc<Schema> = StringSchema::new("Command.")
-        .format(Arc::new(ApiStringFormat::Enum(vec![
-            "start".into(),
-            "status".into(),
-            "stop".into()
-        ])))
-        .into();
-
-    let schema = ObjectSchema::new("Parameters.")
-        .required("command", command);
-
-    let args: Vec<String> = std::env::args().skip(1).collect();
-
-    let options = match getopts::parse_arguments(&args, &vec!["command"], &schema) {
-        Ok((options, rest)) => {
-            if !rest.is_empty() {
-                eprintln!("Error: got additional arguments: {:?}", rest);
-                std::process::exit(-1);
-            }
-            options
-        }
-        Err(err) => {
-            eprintln!("Error: unable to parse arguments:\n{}", err);
-            std::process::exit(-1);
-        }
-    };
-
-    let command = options["command"].as_str().unwrap();
-
-    match command {
-        "start" => {
-            println!("Starting server.");
-        },
-        "stop" => {
-            println!("Stopping server.");
-            std::process::exit(0);
-        },
-        "status" => {
-            println!("Server status.");
-             std::process::exit(0);
-       },
-        _ => {
-            eprintln!("got unexpected command {}", command);
-            std::process::exit(-1);
-        },
-    }
-
     let addr = ([127,0,0,1], 82).into();
 
     lazy_static!{
index 5d3455e7068633400ceab388ac9bf14cef9aeba2..cc62e33f38af99acae4e5e9bfecf93744f3ecba1 100644 (file)
@@ -1,12 +1,8 @@
 extern crate proxmox_backup;
 
-use std::sync::Arc;
-
-use proxmox_backup::api::schema::*;
 use proxmox_backup::api::router::*;
 use proxmox_backup::api::config::*;
 use proxmox_backup::server::rest::*;
-use proxmox_backup::getopts;
 use proxmox_backup::auth_helpers::*;
 
 //use failure::*;
@@ -29,53 +25,6 @@ fn main() {
     let _ = public_auth_key(); // load with lazy_static
     let _ = csrf_secret(); // load with lazy_static
 
-    let command : Arc<Schema> = StringSchema::new("Command.")
-        .format(Arc::new(ApiStringFormat::Enum(vec![
-            "start".into(),
-            "status".into(),
-            "stop".into()
-        ])))
-        .into();
-
-    let schema = ObjectSchema::new("Parameters.")
-        .required("command", command);
-
-    let args: Vec<String> = std::env::args().skip(1).collect();
-
-    let options = match getopts::parse_arguments(&args, &vec!["command"], &schema) {
-        Ok((options, rest)) => {
-            if !rest.is_empty() {
-                eprintln!("Error: got additional arguments: {:?}", rest);
-                std::process::exit(-1);
-            }
-            options
-        }
-        Err(err) => {
-            eprintln!("Error: unable to parse arguments:\n{}", err);
-            std::process::exit(-1);
-        }
-    };
-
-    let command = options["command"].as_str().unwrap();
-
-    match command {
-        "start" => {
-            println!("Starting server.");
-        },
-        "stop" => {
-            println!("Stopping server.");
-            std::process::exit(0);
-        },
-        "status" => {
-            println!("Server status.");
-             std::process::exit(0);
-       },
-        _ => {
-            eprintln!("got unexpected command {}", command);
-            std::process::exit(-1);
-        },
-    }
-
     let addr = ([0,0,0,0,0,0,0,0], 8007).into();
 
     lazy_static!{