2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 10:40:24 +00:00

add restapi for changing node name.

This commit is contained in:
amy0701
2015-05-25 02:32:35 -04:00
parent 0b3e4b2bc4
commit 1d1e7db8c9

View File

@@ -144,6 +144,18 @@ my %URIdef = (
outhdler => \&noout,
},
},
noderename => {
desc => "[URI:/nodes/{noderange}/rename] - Change old_nodename into new_nodename",
matcher => '^/nodes/[^/]*/rename$',
PUT => {
desc => "Change node name.",
usage => "||$usagemsg{non_getreturn}|",
example => "|Change nodename for node \'node1\'.|PUT|/nodes/node1/rename||",
cmd => "chdef",
fhandler => \&actionhdl,
outhdler => \&defout_remove_appended_info,
},
},
nodedns => {
desc => "[URI:/nodes/{noderange}/dns] - The dns record resource for the node {noderange}",
matcher => '^/nodes/[^/]*/dns$',
@@ -2029,6 +2041,15 @@ sub actionhdl {
error ("Lack of operation data.",$STATUS_BAD_REQUEST,3);
}
}
} elsif ($params->{'resourcename'} eq "noderename") {
if (isPut()) {
if (defined ($paramhash->{'newNode'})) { #specify the new name for node
push @args, ('-t', "node");
push @args, ('-o', $urilayers[1]);
push @args, ('-n', $paramhash->{'newNode'});
}
}
}
push @{$request->{arg}}, @args;