From 2cb38161a8672122618991437aaa41ce334022f2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 22 May 2013 18:15:50 +0000 Subject: [PATCH] Add some more commands, have powershell recognize the multiple natures of data elements in api git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16399 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/netboot/windows/xCAT.psm1 | 64 ++++++++++++++++--- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 index 5a973f4ec..c7099e857 100644 --- a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 +++ b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 @@ -199,6 +199,44 @@ Function Get-NodeBeacon { $xcatrequest=@{'command'='rbeacon';'noderange'=$nodeRange;'args'=@('stat')} Send-xCATCommand($xcatrequest) } +Function Get-NodeBoot { + Param( + [parameter(ValueFromPipeLine=$true)] $nodeRange + ) + $pipednr=@($input) + if ($pipednr) { $nodeRange = $pipednr } + $xcatrequest=@{'command'='rsetboot';'noderange'=$nodeRange;'args'=@('stat')} + Send-xCATCommand($xcatrequest) +} +Function Get-NodeDeploy { + Param( + [parameter(ValueFromPipeLine=$true)] $nodeRange + ) + $pipednr=@($input) + if ($pipednr) { $nodeRange = $pipednr } + $xcatrequest=@{'command'='nodeset';'noderange'=$nodeRange;'args'=@('stat')} + Send-xCATCommand($xcatrequest) +} +Function Set-NodeDeploy { + Param( + [parameter(ValueFromPipeLine=$true)] $nodeRange, + $deployAction + ) + $pipednr=@($input) + if ($pipednr) { $nodeRange = $pipednr } + $xcatrequest=@{'command'='nodeset';'noderange'=$nodeRange;'args'=@($deployAction)} + Send-xCATCommand($xcatrequest) +} +Function Set-NodeBoot { + Param( + [parameter(ValueFromPipeLine=$true)] $nodeRange, + $bootDevice + ) + $pipednr=@($input) + if ($pipednr) { $nodeRange = $pipednr } + $xcatrequest=@{'command'='rsetboot';'noderange'=$nodeRange;'args'=@($bootDevice)} + Send-xCATCommand($xcatrequest) +} Function Set-NodeBeacon { Param( [parameter(ValueFromPipeLine=$true)] $nodeRange, @@ -376,15 +414,21 @@ Function NewxCATDataFromXmlElement { if ($xmlElement.name) { $myprops.Node=$xmlElement.name } - if ($xmlElement.data.desc) { - $objname = 'xCATNodeData' - $myprops.Description=$xmlElement.data.desc - } - if ($xmlElement.data.contents) { - $myprops.Data=$xmlElement.data.contents - } else { - $myprops.Data="" - } + if ($xmlElement.data) { + if ($xmlElement.data.GetType().Name -eq "String") { + $myprops.Data=$xmlElement.data + } else { + if ($xmlElement.data.desc) { + $objname = 'xCATNodeData' + $myprops.Description=$xmlElement.data.desc + } + if ($xmlElement.data.contents) { + $myprops.Data=$xmlElement.data.contents + } else { + $myprops.Data="" + } + } + } if ($xmlElement.error) { $objname = 'xCATNodeErrorData' $errstr= $xmlElement.name + ": " + $xmlElement.error @@ -395,6 +439,8 @@ Function NewxCATDataFromXmlElement { $myobj.PSObject.TypeNames.Insert(0,$objname) return $myobj } +New-Alias -name rsetboot -value Set-NodeBoot +New-Alias -name nodeset -value Set-NodeDeploy New-Alias -name rpower -value Set-NodePower New-Alias -name rvitals -value Get-Nodevitals New-Alias -name rinv -value Get-NodeInventory