2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-13 09:50:19 +00:00

deal with rspconfig in python

This commit is contained in:
zhao er tao
2018-02-02 23:40:37 +08:00
parent ce3a32fdeb
commit 5d1c8c7092
2 changed files with 32 additions and 1 deletions

View File

@ -696,7 +696,6 @@ class OpenBMCManager(base.BaseManager):
else:
DefaultSensorManager().get_sensor_info(runner, action)
def _get_full_path(self,file_path):
if type(self.cwd) == 'unicode':
dir_path = self.cwd

View File

@ -113,6 +113,10 @@ sub process_request {
$callback = shift;
my $noderange = $request->{node};
my $check = parse_node_info($noderange);
if (&refactor_args($request)) {
xCAT::MsgUtils->message("E", { data => ["Failed to refactor arguments"] }, $callback);
return;
}
$callback->({ errorcode => [$check] }) if ($check);
return unless(%node_info);
my $pid = xCAT::OPENBMC::start_python_agent();
@ -298,4 +302,32 @@ sub parse_node_info {
return $rst;
}
#-------------------------------------------------------
=head3 refactor_args
refractor args to be easily dealt by python client
=cut
#-------------------------------------------------------
sub refactor_args {
my $request = shift;
my $command = $request->{command}->[0];
my $extrargs = $request->{arg};
if ($command eq "rspconfig") {
if ($extrargs->[0] eq "dump") {
$request->{arg}->[0] = "--dump";
} else {
foreach my $arg (@$extrargs) {
if ($arg !~ /^-/) {
$arg = "--".$arg;
}
}
}
}
return 0;
}
1;