From e6cee5014a54ec1994cdca04647e9a74f6a4fb8a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 25 Mar 2013 13:57:47 +0000 Subject: [PATCH] Work towards an xcoll workalike, also likely a xcsv workalike git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15649 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/netboot/windows/xCAT.psm1 | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 index 2b5e01a67..9f4e230c9 100644 --- a/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 +++ b/xCAT-server/share/xcat/netboot/windows/xCAT.psm1 @@ -101,8 +101,11 @@ Function Get-NodePower { $xcatrequest=@{'command'='rpower';'noderange'=$nodeRange;'args'=@('stat')} Send-xCATCommand($xcatrequest) } -Function Merge-xCATData { +Function Merge-xCATData { #xcoll attempt $groupeddata=$input|Group-Object -Property "node" + foreach ($nodedata in $groupeddata) { + New-MergedxCATData $nodedata.Group + } } Function Set-NodePower { @@ -191,15 +194,19 @@ Function Send-xCATCommand { Function New-MergedxCATData { #takes an arbitrary number of nodeData objects and spits out one Param( - [parameter(ValueFromRemainingArguments=$true)] $nodeData + $nodeData ) - $myprops = @{} - $myprops.Data=@() - $myprops.Node = $nodeData[0].Node + $myobj = @{} + $myobj.dataObjects=@() + $myobj.NodeRange = $nodeData[0].Node foreach ($data in $nodeData) { - $myprops.DataObjects += $data|select-object -ExcludeProperty Node * + $rangedata = $data|select-object -ExcludeProperty Node * + $rangedata.PSObject.TypeNames.RemoveAt(0) + $myobj.dataObjects = $myobj.dataObjects + $rangedata } - write-host $myprops + $newobj = New-Object -TypeName PSObject -Prop $myobj + $newobj.PSObject.TypeNames.Insert(0,'xCATNodeRangeData') + return $newobj } Function New-xCATDataFromXmlElement { Param(