[pve-devel] [PATCH v2 manager 1/3] add pveceph install to shell api
Tim Marx
t.marx at proxmox.com
Mon Jan 21 16:04:49 CET 2019
Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
changes since v1:
* changed approach to enum
* switched to new standard option
PVE/API2/Nodes.pm | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 7f829b29..6e861805 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -705,6 +705,7 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => get_standard_option('shellcmd'),
websocket => {
optional => 1,
type => 'boolean',
@@ -778,6 +779,10 @@ __PACKAGE__->register_method ({
my $upgradecmd = "pveupgrade --shell";
$upgradecmd = PVE::Tools::shellquote($upgradecmd) if $remip;
$shcmd = [ '/bin/bash', '-c', $upgradecmd ];
+ } elsif ($param->{cmd}) {
+ if ($param->{cmd} eq 'ceph_install') {
+ $shcmd = [ '/usr/bin/pveceph', 'install' ];
+ }
} else {
$shcmd = [ '/bin/login', '-f', 'root' ];
}
@@ -864,6 +869,7 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => get_standard_option('shellcmd'),
},
},
returns => {
@@ -908,6 +914,10 @@ __PACKAGE__->register_method ({
if ($user eq 'root at pam') {
if ($param->{upgrade}) {
$concmd = [ '/usr/bin/pveupgrade', '--shell' ];
+ } elsif ($param->{cmd}) {
+ if ($param->{cmd} eq 'ceph_install') {
+ $concmd = [ '/usr/bin/pveceph', 'install' ];
+ }
} else {
$concmd = [ '/bin/login', '-f', 'root' ];
}
@@ -1011,6 +1021,7 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => get_standard_option('shellcmd'),
},
},
returns => get_standard_option('remote-viewer-config'),
@@ -1038,6 +1049,10 @@ __PACKAGE__->register_method ({
if ($param->{upgrade}) {
my $upgradecmd = "pveupgrade --shell";
$shcmd = [ '/bin/bash', '-c', $upgradecmd ];
+ } elsif ($param->{cmd}) {
+ if ($param->{cmd} eq 'ceph_install') {
+ $shcmd = [ '/usr/bin/pveceph', 'install' ];
+ }
} else {
$shcmd = [ '/bin/login', '-f', 'root' ];
}
--
2.11.0
More information about the pve-devel
mailing list