2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-24 15:05:36 +00:00

Merge pull request #1450 from chenglch/restapi_console

Add restapi for console
This commit is contained in:
Xiaopeng Wang
2016-07-04 10:33:35 +08:00
committed by GitHub

View File

@ -217,6 +217,18 @@ my %URIdef = (
outhdler => \&noout,
}
},
console => {
desc => "[URI:/nodes/{noderange}/console] - The console configuration for the node {noderange}",
matcher => '^/nodes/[^/]*/console$',
PUT => {
desc => "Update conserver configuration for the node {noderange}.",
usage => "|Json Formatted DataBody: {action:on/off}.|$usagemsg{non_getreturn}|",
example => "|Enable the console capability for node1|PUT|/nodes/node1/console {\"action\":\"on\"}||",
cmd => "makeconservercf",
fhandler => \&actionhdl,
outhdler => \&noout,
}
},
energy => {
desc => "[URI:/nodes/{noderange}/energy] - The energy resource for the node {noderange}",
matcher => '^/nodes/[^/]*/energy$',
@ -2119,6 +2131,14 @@ sub actionhdl {
}
}
} elsif ($params->{'resourcename'} eq "console") {
if ($paramhash->{'action'}) {
my $option = $paramhash->{'action'};
my %op_hash = ('on' => '', 'off' => '-d');
push @args, $op_hash{$paramhash->{'action'}};
} else {
error("Missed Action.",$STATUS_NOT_FOUND);
}
}
push @{$request->{arg}}, @args;