2013-03-25 13:56:33 +00:00
|
|
|
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
# This function specifically validates that the peer we are talking to is signed by the xCAT blessed CA and no other CA
|
2013-03-25 13:58:01 +00:00
|
|
|
Function Import-xCATConfig ($credentialPackage) {
|
|
|
|
$shell = New-Object -com shell.application
|
|
|
|
(Get-Location).Path+"\$credentialPackage"
|
|
|
|
$credpkg = $shell.namespace((Get-Location).Path+"\$credentialPackage")
|
|
|
|
$credpkg
|
|
|
|
$randname = [System.IO.Path]::GetRandomFileName()
|
|
|
|
Push-Location
|
|
|
|
mkdir $env:temp+"\"+$randname
|
|
|
|
Set-Location $env:temp+"\"+$randname
|
|
|
|
$tmpdir = $shell.namespace((Get-Location).Path)
|
|
|
|
$tmpdir
|
|
|
|
$tmpdir.CopyHere($credpkg.items(),0x14)
|
|
|
|
if (!(Test-Path HKCU:\Software\xCAT)) {
|
|
|
|
mkdir HKCU:\Software\xCAT
|
|
|
|
}
|
|
|
|
if (Test-Path xcat.cfg) {
|
|
|
|
$cfgdata=Get-Content xcat.cfg
|
|
|
|
$keyvalue = $cfgdata.Split("=")
|
|
|
|
$servername = $keyvalue[1]
|
|
|
|
Set-ItemProperty HKCU:\Software\xCAT servername $servername
|
|
|
|
}
|
|
|
|
if (Test-Path ca.pem) {
|
|
|
|
ImportxCATCA ca.pem
|
|
|
|
}
|
|
|
|
if (Test-Path user.pfx) {
|
|
|
|
SetxCATClientCertificate user.pfx
|
|
|
|
}
|
|
|
|
Pop-Location
|
|
|
|
}
|
2013-03-25 13:57:10 +00:00
|
|
|
Function VerifyxCATCert ($sender, $cert, $chain, $polerrs) {
|
|
|
|
if ($polerrs -ne "None" -and $polerrs -ne "RemoteCertificateChainErrors") { return $false } #if the overall policy suggests rejection, go with it
|
|
|
|
#why do we tolerate RemoteCertificateChainErrors? Because we are going to check specifically for the CA configured for this xCAT installation
|
|
|
|
#we chose not to add xCAT's CA to the root store, as that implies the OS should trust xCAT's CA for non-xCAT related things. That is madness.
|
|
|
|
#Of course, that's the madness typical with x509, but we need not propogate the badness...
|
|
|
|
#we are measuring something more specific than 'did any old CA sign this', we specifically want to assue the signer CA is xCAT's
|
2013-03-25 13:58:01 +00:00
|
|
|
$mythumb=Get-ItemProperty HKCU:\Software\xCAT
|
2013-03-25 13:56:33 +00:00
|
|
|
foreach ($cert in $chain.chainElements) {
|
2013-03-25 13:58:01 +00:00
|
|
|
if ($mythumb.cacertthumb.Equals($cert.Certificate.thumbprint)) {
|
2013-03-25 13:56:39 +00:00
|
|
|
return $true
|
|
|
|
}
|
2013-03-25 13:56:33 +00:00
|
|
|
}
|
2013-03-25 13:56:39 +00:00
|
|
|
return $false
|
2013-03-25 13:56:33 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 13:57:10 +00:00
|
|
|
#we import the xCAT certificate authority into the appropriate scope.
|
|
|
|
#It's not trusted by system policy, but our overidden verify function will find it. Too bad MS doesn't allow us custom store names under the user
|
|
|
|
#repository for whatever reason. We'll just 'import' it every session from file, which is harmless to do multiple times
|
|
|
|
#this isn't quite as innocuous as the openssl mechanisms to do this sort of thing, but it's as close as I could figure to get
|
2013-03-25 13:58:01 +00:00
|
|
|
Function ImportxCATCA ( $certpath ) {
|
|
|
|
$xcatcacert=Import-Certificate -FilePath $certpath -CertStoreLocation Cert:\CurrentUser\My
|
|
|
|
Set-ItemProperty HKCU:\Software\xCAT cacertthumb $xcatcacert.thumbprint
|
2013-03-25 13:56:33 +00:00
|
|
|
}
|
2013-03-25 13:56:39 +00:00
|
|
|
|
2013-03-25 13:57:10 +00:00
|
|
|
#this removes the xCAT CA from trust store, if user wishes to explicitly remove xCAT key post deploy
|
|
|
|
#A good idea for appliances that want to not show weird stuff. The consequences of not calling it are harmless: a useless extra public cert
|
|
|
|
#in admin's x509 cert store
|
2013-03-25 13:58:01 +00:00
|
|
|
Function RemovexCATCA {
|
|
|
|
$mythumb=Get-ItemProperty HKCU:\Software\xCAT
|
|
|
|
rm cert:\CurrentUser\My\$mythumb.cacertthumb
|
2013-03-25 13:56:33 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 13:56:39 +00:00
|
|
|
#specify a client certificate to use in pfx format
|
2013-03-25 13:58:01 +00:00
|
|
|
Function SetxCATClientCertificate ( $pfxPath ) {
|
|
|
|
$xcatclientcert=Import-pfxCertificate $pfxPath -certStoreLocation cert:\currentuser\my
|
|
|
|
Set-ItemProperty HKCU:\Software\xCAT usercertthumb $xcatclientcert.thumbprint
|
2013-03-25 13:56:39 +00:00
|
|
|
}
|
2013-03-25 13:58:01 +00:00
|
|
|
Function RemovexCATClientCertificate {
|
|
|
|
SetxCATClientCertificate($pfxpath)
|
|
|
|
$mythumb=Get-ItemProperty HKCU:\Software\xCAT
|
|
|
|
rm cert:\currentuser\my\$mythumb.usercertthumb
|
2013-03-25 13:56:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#key here is that we might have two certificates:
|
|
|
|
#-one intended to identify the system that was deployed by xcat
|
|
|
|
#-one intended to identify the user to do things like 'rpower'
|
2013-03-25 13:57:10 +00:00
|
|
|
#however, user will just have to control it by calling Set-xCATClientCertificate on the file for now
|
|
|
|
#TODO: if user wants password protected PFX file, we probably would want to import it once and retain thumb across sessions...
|
2013-03-25 13:58:01 +00:00
|
|
|
Function SelectxCATClientCert ($sender, $targetHost, $localCertificates, $remoteCertificate,$acceptableIssuers) {
|
|
|
|
$mythumb=(Get-ItemProperty HKCU:\Software\xCAT).usercertthumb
|
|
|
|
Get-Item cert:\CurrentUser\My\$mythumb
|
|
|
|
}
|
|
|
|
Function Set-xCATServer {
|
|
|
|
Param(
|
|
|
|
[Parameter(Mandatory=$true)] $xCATServer
|
|
|
|
)
|
|
|
|
Set-ItemProperty HKCU:\Software\xCAT serveraddress $xCATServer
|
2013-03-25 13:56:39 +00:00
|
|
|
}
|
2013-03-25 13:56:44 +00:00
|
|
|
Function Connect-xCAT {
|
2013-03-25 13:56:39 +00:00
|
|
|
Param(
|
2013-03-25 13:58:01 +00:00
|
|
|
$mgtServer,
|
2013-03-25 13:57:04 +00:00
|
|
|
$mgtServerPort=3001,
|
2013-03-25 13:58:01 +00:00
|
|
|
$mgtServerAltName
|
2013-03-25 13:56:39 +00:00
|
|
|
)
|
2013-03-25 13:58:01 +00:00
|
|
|
if (! $mgtServer) {
|
|
|
|
$mgtServer=(Get-ItemProperty HKCU:\Software\xCAT).serveraddress
|
|
|
|
if (! $mgtServer) {
|
|
|
|
$mgtServer=(Get-ItemProperty HKCU:\Software\xCAT).servername
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (! $mgtServerAltName) {
|
|
|
|
$mgtServerAltName=(Get-ItemProperty HKCU:\Software\xCAT).servername
|
|
|
|
}
|
2013-03-25 13:57:04 +00:00
|
|
|
$script:xcatconnection = New-Object Net.Sockets.TcpClient($mgtServer,$mgtServerPort)
|
2013-03-25 13:58:01 +00:00
|
|
|
if (! $script:xcatconnection) {
|
|
|
|
return $false
|
|
|
|
}
|
2013-03-25 13:57:22 +00:00
|
|
|
$verifycallback = Get-Content Function:\VerifyxCATCert
|
2013-03-25 13:58:01 +00:00
|
|
|
$certselect = Get-Content Function:\SelectxCATClientCert
|
2013-03-25 13:57:10 +00:00
|
|
|
$script:xcatstream = $script:xcatconnection.GetStream()
|
2013-03-25 13:57:22 +00:00
|
|
|
$script:securexCATStream = New-Object System.Net.Security.SSLStream($script:xcatstream,$false,$verifycallback,$certselect)
|
2013-03-25 13:57:10 +00:00
|
|
|
$script:securexCATStream.AuthenticateAsClient($mgtServerAltName)
|
2013-03-25 13:57:16 +00:00
|
|
|
$script:xcatwriter = New-Object System.IO.StreamWriter($script:securexCATStream)
|
|
|
|
$script:xcatreader = New-Object System.IO.StreamReader($script:securexCATStream)
|
2013-03-25 13:58:01 +00:00
|
|
|
$true
|
2013-03-25 13:57:16 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 13:57:42 +00:00
|
|
|
Function Get-NodeInventory {
|
|
|
|
Param(
|
|
|
|
[parameter(ValueFromPipeLine=$true)] $nodeRange,
|
|
|
|
[parameter(ValueFromRemainingArguments=$true)] $inventoryType
|
|
|
|
)
|
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
|
|
|
$xcatrequest=@{'command'='rinv';'noderange'=$nodeRange;'args'=@($inventoryType)}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
|
|
|
Function Get-NodeBeacon {
|
|
|
|
Param(
|
|
|
|
[parameter(ValueFromPipeLine=$true)] $nodeRange
|
|
|
|
)
|
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
|
|
|
$xcatrequest=@{'command'='rbeacon';'noderange'=$nodeRange;'args'=@('stat')}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
|
|
|
Function Set-NodeBeacon {
|
|
|
|
Param(
|
|
|
|
[parameter(ValueFromPipeLine=$true)] $nodeRange,
|
|
|
|
$newBeaconState
|
|
|
|
)
|
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
|
|
|
$xcatrequest=@{'command'='rbeacon';'noderange'=$nodeRange;'args'=@($newBeaconState)}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
2013-03-25 13:57:30 +00:00
|
|
|
Function Get-NodePower {
|
2013-03-25 13:57:16 +00:00
|
|
|
Param(
|
2013-03-25 13:57:42 +00:00
|
|
|
[parameter(Position=0,ValueFromPipeLine=$true)] $nodeRange
|
2013-03-25 13:57:16 +00:00
|
|
|
)
|
2013-03-25 13:57:42 +00:00
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
2013-03-25 13:57:30 +00:00
|
|
|
$xcatrequest=@{'command'='rpower';'noderange'=$nodeRange;'args'=@('stat')}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
2013-03-25 13:57:47 +00:00
|
|
|
Function Merge-xCATData { #xcoll attempt
|
2013-03-25 13:57:42 +00:00
|
|
|
$groupeddata=$input|Group-Object -Property "node"
|
2013-03-25 13:57:55 +00:00
|
|
|
$hashbyoutput=@{}
|
2013-03-25 13:57:47 +00:00
|
|
|
foreach ($nodedata in $groupeddata) {
|
2013-03-25 13:57:55 +00:00
|
|
|
$gdata= NewMergedxCATData $nodedata.Group
|
|
|
|
if ($hashbyoutput.Contains($gdata.stringcontent)) {
|
|
|
|
$hashbyoutput.Get_Item($gdata.stringcontent).NodeList += $gdata.NodeList
|
|
|
|
} else {
|
|
|
|
$hashbyoutput.Add($gdata.stringcontent,$gdata)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$distinctoutput=$hashbyoutput.GetEnumerator()
|
|
|
|
foreach ($collateddata in $distinctoutput) {
|
|
|
|
$findata = $collateddata.Value
|
|
|
|
$findata.NodeRange=[string]::Join(",",$findata.NodeList)
|
|
|
|
$findata = $findata |select-object -excludeproperty NodeRangeHint,stringcontent *
|
|
|
|
$mobjname = 'MergedxCATSimpleNodeData'
|
|
|
|
foreach ($do in $findata.dataObjects) {
|
2013-03-25 13:58:01 +00:00
|
|
|
if ($do.ErrorData) {
|
|
|
|
$mobjname='MergedxCATNodeErrorData'
|
|
|
|
break
|
|
|
|
} elseif ($do.description) {
|
2013-03-25 13:57:55 +00:00
|
|
|
$mobjname='MergedxCATNodeData'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($do in $findata.dataObjects) {
|
|
|
|
$do|Add-Member -MemberType NoteProperty -Name NodeRange -Value $findata.NodeRange
|
|
|
|
$do.PSObject.TypeNames.Insert(0,$mobjname)
|
|
|
|
$do
|
|
|
|
}
|
2013-03-25 13:57:47 +00:00
|
|
|
}
|
2013-03-25 13:57:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
Function Set-NodePower {
|
|
|
|
Param(
|
|
|
|
[parameter(ValueFromPipeLine=$true)] $nodeRange,
|
|
|
|
[parameter(HelpMessage="The power action to perform (on/off/boot/reset)")] $powerState="stat"
|
|
|
|
)
|
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
|
|
|
$xcatrequest=@{'command'='rpower';'noderange'=$nodeRange;'args'=@($powerState)}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
2013-03-25 13:57:37 +00:00
|
|
|
Function Get-Nodes {
|
|
|
|
Param(
|
2013-03-25 13:57:42 +00:00
|
|
|
[parameter(Position=0,ValueFromPipeLine=$true)] $nodeRange,
|
|
|
|
[parameter(ValueFromRemainingArguments=$true)] $tableAndColumn
|
2013-03-25 13:57:37 +00:00
|
|
|
)
|
2013-03-25 13:57:42 +00:00
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
|
|
|
$xcatrequest=@{'command'='nodels';'noderange'=$nodeRange;'args'=@($tableAndColumn)}
|
2013-03-25 13:57:37 +00:00
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
2013-03-25 13:57:30 +00:00
|
|
|
Function Get-NodeVitals {
|
|
|
|
Param(
|
2013-03-25 13:57:42 +00:00
|
|
|
[parameter(Position=0,ValueFromPipeLine=$true)] $nodeRange,
|
2013-03-25 13:57:37 +00:00
|
|
|
[parameter(ValueFromRemainingArguments=$true)] $vitalTypes="all"
|
2013-03-25 13:57:30 +00:00
|
|
|
)
|
2013-03-25 13:57:42 +00:00
|
|
|
$pipednr=@($input)
|
|
|
|
if ($pipednr) { $nodeRange = $pipednr }
|
2013-03-25 13:57:30 +00:00
|
|
|
$xcatrequest=@{'command'='rvitals';'noderange'=$nodeRange;'args'=@($vitalTypes)}
|
|
|
|
Send-xCATCommand($xcatrequest)
|
|
|
|
}
|
|
|
|
Function Send-xCATCommand {
|
|
|
|
Param(
|
|
|
|
$xcatRequest
|
|
|
|
)
|
2013-03-25 13:58:01 +00:00
|
|
|
if (!(Connect-xCAT)) { return }
|
2013-03-25 13:57:30 +00:00
|
|
|
$requestxml = "<xcatrequest>`n`t<command>"+$xcatRequest.command+"</command>`n"
|
|
|
|
if ($xcatRequest.noderange) {
|
2013-03-25 13:57:42 +00:00
|
|
|
if ($xcatRequest.noderange.PSObject.TypeNames[0] -eq "xCATNodeData") {
|
|
|
|
$xcatRequest.noderange = $xcatRequest.noderange.Node
|
|
|
|
}
|
2013-03-25 13:57:37 +00:00
|
|
|
if ($xcatRequest.noderange -is [System.Array]) { #powershell wants to arrayify commas because it can't make up its mind
|
|
|
|
#whether it's a scripting language or a shell language, try to undo the
|
|
|
|
#damage
|
2013-03-25 13:57:42 +00:00
|
|
|
$nrparts=@()
|
|
|
|
foreach ($nr in $xcatRequest.noderange) {
|
|
|
|
if ($nr -is [System.String]) {
|
|
|
|
$nrparts += $nr
|
2013-03-25 13:57:55 +00:00
|
|
|
} elseif ($nr.PSObject.TypeNames[0] -like "xCAT*Node*Data") {
|
2013-03-25 13:57:42 +00:00
|
|
|
$nrparts += $nr.Node
|
2013-03-25 13:57:55 +00:00
|
|
|
} elseif ($nr.PSObject.TypeNames[0] -like "Merge*xCAT*Node*Data") {
|
|
|
|
$nrparts += $nr.NodeRange
|
2013-03-25 13:57:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$xcatRequest.noderange=[string]::Join(",",$nrparts);
|
2013-03-25 13:57:37 +00:00
|
|
|
}
|
2013-03-25 13:57:30 +00:00
|
|
|
$requestxml = $requestxml + "`t<noderange>"+$xcatRequest.noderange+"</noderange>`n"
|
|
|
|
}
|
|
|
|
foreach ($arg in $xcatRequest.args) {
|
2013-03-25 13:57:37 +00:00
|
|
|
if ($arg) {
|
|
|
|
if ($arg -is [System.Array]) {
|
|
|
|
$arg=[string]::join(",",$arg);
|
|
|
|
}
|
|
|
|
$requestxml = $requestxml + "`t<arg>"+$arg+"</arg>`n"
|
|
|
|
}
|
2013-03-25 13:57:30 +00:00
|
|
|
}
|
|
|
|
$requestxml = $requestxml + "</xcatrequest>`n"
|
|
|
|
$script:xcatwriter.WriteLine($requestxml)
|
2013-03-25 13:57:16 +00:00
|
|
|
$script:xcatwriter.Flush()
|
2013-03-25 13:57:30 +00:00
|
|
|
$serverdone=0
|
|
|
|
while (! $serverdone -and $script:xcatreader) {
|
|
|
|
$responsexml=""
|
|
|
|
$lastline=""
|
|
|
|
while ($lastline -ne $null -and ! $lastline.Contains("</xcatresponse>") -and $script:xcatreader) {
|
|
|
|
$lastline = $script:xcatreader.ReadLine()
|
|
|
|
$responsexml = $responsexml + $lastline
|
|
|
|
}
|
|
|
|
[xml]$response = $responsexml
|
2013-03-25 13:57:37 +00:00
|
|
|
foreach ($elem in $response.xcatresponse.node) {
|
2013-03-25 13:57:55 +00:00
|
|
|
NewxCATDataFromXmlElement $elem -NodeRangeHint $xcatRequest.noderange
|
|
|
|
}
|
|
|
|
foreach ($elem in $response.xcatresponse.error) {
|
|
|
|
Write-Error $elem
|
2013-03-25 13:57:37 +00:00
|
|
|
}
|
|
|
|
#$response.xcatresponse.node.name
|
|
|
|
#$response.xcatresponse.node.data
|
2013-03-25 13:57:30 +00:00
|
|
|
if ($response.xcatresponse.serverdone -ne $null) { $serverdone=1 }
|
2013-03-25 13:57:16 +00:00
|
|
|
}
|
2013-03-25 13:56:44 +00:00
|
|
|
}
|
2013-03-25 13:57:30 +00:00
|
|
|
|
2013-03-25 13:57:55 +00:00
|
|
|
Function NewMergedxCATData { #takes an arbitrary number of nodeData objects and spits out one
|
2013-03-25 13:57:42 +00:00
|
|
|
Param(
|
2013-03-25 13:57:47 +00:00
|
|
|
$nodeData
|
2013-03-25 13:57:42 +00:00
|
|
|
)
|
2013-03-25 13:57:47 +00:00
|
|
|
$myobj = @{}
|
|
|
|
$myobj.dataObjects=@()
|
2013-03-25 13:57:55 +00:00
|
|
|
$myobj.NodeList = @($nodeData[0].Node)
|
|
|
|
$myobj.NodeRangeHint = $nodeData[0].NodeRangeHint
|
|
|
|
$myobj.stringcontent = ""
|
|
|
|
$myobj.NodeRange = ""
|
2013-03-25 13:57:42 +00:00
|
|
|
foreach ($data in $nodeData) {
|
2013-03-25 13:57:55 +00:00
|
|
|
$rangedata = $data|select-object -ExcludeProperty Node,NodeRangeHint *
|
|
|
|
foreach ($dataseg in $rangedata) {
|
2013-03-25 13:58:01 +00:00
|
|
|
if ($dataseg.ErrorData) { $myobj.stringcontent += "ERROR: "+$dataseg.ErrorData }
|
2013-03-25 13:57:55 +00:00
|
|
|
$myobj.stringcontent += $dataseg.Description+": "+$dataseg.Data+"`n"
|
|
|
|
}
|
2013-03-25 13:57:47 +00:00
|
|
|
$myobj.dataObjects = $myobj.dataObjects + $rangedata
|
2013-03-25 13:57:42 +00:00
|
|
|
}
|
2013-03-25 13:57:47 +00:00
|
|
|
$newobj = New-Object -TypeName PSObject -Prop $myobj
|
2013-03-25 13:57:55 +00:00
|
|
|
$newobj.PSObject.TypeNames.Insert(0,'TempxCATNodeRangeData')
|
2013-03-25 13:57:47 +00:00
|
|
|
return $newobj
|
2013-03-25 13:57:42 +00:00
|
|
|
}
|
2013-03-25 13:57:55 +00:00
|
|
|
Function NewxCATDataFromXmlElement {
|
2013-03-25 13:57:37 +00:00
|
|
|
Param(
|
|
|
|
$xmlElement,
|
|
|
|
$NodeRangeHint
|
|
|
|
)
|
|
|
|
$myprops = @{}
|
2013-03-25 13:57:55 +00:00
|
|
|
$objname = 'xCATSimpleNodeData'
|
2013-03-25 13:57:37 +00:00
|
|
|
if ($NodeRangeHint) { #hypothetically, 'xcoll' implementation might find this handy
|
|
|
|
$myprops.NodeRangeHint=$NodeRangeHint
|
|
|
|
}
|
|
|
|
if ($xmlElement.name) {
|
|
|
|
$myprops.Node=$xmlElement.name
|
|
|
|
}
|
|
|
|
if ($xmlElement.data.desc) {
|
2013-03-25 13:57:55 +00:00
|
|
|
$objname = 'xCATNodeData'
|
2013-03-25 13:57:37 +00:00
|
|
|
$myprops.Description=$xmlElement.data.desc
|
|
|
|
}
|
|
|
|
if ($xmlElement.data.contents) {
|
|
|
|
$myprops.Data=$xmlElement.data.contents
|
|
|
|
} else {
|
|
|
|
$myprops.Data=""
|
|
|
|
}
|
2013-03-25 13:57:55 +00:00
|
|
|
if ($xmlElement.error) {
|
2013-03-25 13:58:01 +00:00
|
|
|
$objname = 'xCATNodeErrorData'
|
2013-03-25 13:57:55 +00:00
|
|
|
$errstr= $xmlElement.name + ": " + $xmlElement.error
|
|
|
|
Write-Error $errstr
|
|
|
|
$myprops.ErrorData=$xmlElement.error
|
|
|
|
}
|
2013-03-25 13:57:37 +00:00
|
|
|
$myobj=New-Object -TypeName PSObject -Prop $myprops
|
2013-03-25 13:57:55 +00:00
|
|
|
$myobj.PSObject.TypeNames.Insert(0,$objname)
|
2013-03-25 13:57:37 +00:00
|
|
|
return $myobj
|
|
|
|
}
|
2013-03-25 13:57:42 +00:00
|
|
|
New-Alias -name rpower -value Set-NodePower
|
|
|
|
New-Alias -name rvitals -value Get-Nodevitals
|
|
|
|
New-Alias -name rinv -value Get-NodeInventory
|
|
|
|
New-Alias -name rbeacon -value Set-NodeBeacon
|
|
|
|
New-Alias -name nodels -value Get-Nodes
|
2013-03-25 13:57:55 +00:00
|
|
|
New-Alias -name xcoll -value Merge-xCATData
|
2013-03-25 13:57:42 +00:00
|
|
|
Export-ModuleMember -function *-* -Alias *
|
2013-03-25 13:57:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|