Skip to content

Commit de7fcbc

Browse files
author
Alexei Andreyev
committed
Merge pull request #32 from rsWinAutomationSupport/staging
Merging updates to staging into master
2 parents c1457e4 + 819575c commit de7fcbc

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

rsCommon.psm1

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -347,23 +347,42 @@ Function Test-rsRackConnect {
347347
}
348348
}
349349

350-
Function Test-rsManaged {
351-
if(Test-rsCloud) {
352-
if((Get-rsXenInfo -value "vm-data/user-metadata/rax_service_level_automation").value.count -gt 0 ) {
353-
$exists = $true
350+
# Check if the cloud account is Managed and if so, confirm that server level automation (Servermill) has completed
351+
#
352+
Function Test-rsManaged
353+
{
354+
if(Test-rsCloud)
355+
{
356+
if ((Get-rsAccountDetails).isManaged)
357+
{
358+
$automationComlete = $false
359+
$Timeout = 1800 # Default timeout set to about 30 minutes
360+
do
361+
{
362+
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "Testing for rax_service_level_automation."
363+
if ((Get-rsXenInfo -value "vm-data/user-metadata/rax_service_level_automation") -ne "Complete")
364+
{
365+
$automationComlete = $false
366+
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "Waiting for rax_service_level_automation."
367+
Start-Sleep -Seconds 60
368+
$Timeout = ($Timeout - 60)
369+
}
370+
else
371+
{
372+
$automationComlete = $true
373+
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "rax_service_level_automation complete."
374+
}
375+
}
376+
while (($automationComlete -eq $false) -or ($Timeout -lt 0))
377+
378+
if (($automationComlete -eq $false) -and ($Timeout -lt 0))
379+
{
380+
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Error -EventId 1000 -Message "rax_service_level_automation process timed out - some or all Rackspace cloud automation steps did not complete."
381+
}
354382
}
355-
else {
356-
$exists = $false
357-
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "Testing for rax_service_level_automation."
358-
}
359-
if ( $exists )
383+
else
360384
{
361-
do {
362-
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "Waiting for rax_service_level_automation."
363-
Start-Sleep -Seconds 30
364-
}
365-
while ( (Test-Path "C:\Windows\Temp\rs_managed_cloud_automation_complete.txt" ) -eq $false)
366-
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "rax_service_level_automation complete."
385+
Write-EventLog -LogName DevOps -Source rsCommon -EntryType Information -EventId 1000 -Message "Account is not managed, skipping wait for rax_service_level_automation"
367386
}
368387
}
369388
}

0 commit comments

Comments
 (0)