add desc to the php response when the command is nodels

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7934 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2010-10-27 02:59:50 +00:00
parent 44be87bb74
commit aa6dde8fa5

View File

@ -54,7 +54,7 @@ if (isset($_GET["cmd"])) {
// nodels output needs special handling
else if(strncasecmp($cmd, "nodels", 6) == 0) {
// Handle the output the same way as webrun
$rsp = extractWebrun($xml);
$rsp = extractNodels($xml);
}
// extnoderange output needs special handling
// This command gets the nodes and groups
@ -118,6 +118,35 @@ function extractWebrun($xml) {
return $rsp;
}
/**
* Extract the output for a nodels command
*
* @param $xml The XML output from docmd()
* @return An array containing the output
*/
function extractNodels($xml) {
$rsp = array();
$i = 0;
// Extract data returned
foreach($xml->children() as $nodes){
foreach($nodes->children() as $node){
// Get the node name
$name = $node->name;
// Get the content
$status = $node->data->contents;
$status = str_replace(":|:", "\n", $status);
$description = $node->data->desc;
// Add to return array
$rsp[$i] = array("$name", "$status", "$description");
$i++;
}
}
return $rsp;
}
/**
* Extract the output for a extnoderange command
*