[pve-devel] [PATCH v3 manager 1/3] add pveceph install to shell api
Tim Marx
t.marx at proxmox.com
Tue Jan 22 12:21:56 CET 2019
Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
changed since v2:
* removed get_standard_option
PVE/API2/Nodes.pm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 7f829b29..04fc4f08 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -705,6 +705,12 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => {
+ type => 'string',
+ description => "Run command instead of normal shell.",
+ enum => ['ceph_install'],
+ optional => 1,
+ },
websocket => {
optional => 1,
type => 'boolean',
@@ -778,6 +784,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 +874,12 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => {
+ type => 'string',
+ description => "Run command instead of normal shell.",
+ enum => ['ceph_install'],
+ optional => 1,
+ },
},
},
returns => {
@@ -908,6 +924,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 +1031,12 @@ __PACKAGE__->register_method ({
optional => 1,
default => 0,
},
+ cmd => {
+ type => 'string',
+ description => "Run command instead of normal shell.",
+ enum => ['ceph_install'],
+ optional => 1,
+ },
},
},
returns => get_standard_option('remote-viewer-config'),
@@ -1038,6 +1064,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