CiscoDevNet / intersight-powershell

Cisco Intersight PowerShell
Apache License 2.0
16 stars 4 forks source link

Seeing issues while adding a new policy in PolicyBucket.Add () and deploy the UCS Server Profile #174

Open mdk85-start opened 1 week ago

mdk85-start commented 1 week ago

Describe the bug

We have encountered an issue when attempting to add an existing policy on an existing UCS server profile for CIMC. Please find below the workflow for the code.

Add the policy in policyBucket Set-IntersightServerProfile on the UCS Server Profile Add Start-Sleep for ~5 secs Deploy the UCS Server Profile

Previously, it was not necessary to include Start-Sleep when adding a policy to policyBucket and then deploying the UCS Server Profile.

To Reproduce Steps to reproduce the behavior

    foreach ($serverProfile in $serverProfiles) {

      $serverProfileDetail = Get-IntersightServerProfile -Name $serverProfile -Organization $org
    $checkvKVMPolicy = $serverProfileDetail.PolicyBucket | Where-Object{$_.ActualInstance.ObjectType -eq "KvmPolicy"}
    $serverProfileName = $serverProfileDetail.Name
    $serverProfileDetail.PolicyBucket.Add($kvmPolicy)

     $ScheduledActions11 = Initialize-IntersightPolicyScheduledAction -Action "Deploy"
     $ScheduledActions21 = Initialize-IntersightPolicyScheduledAction -Action "Activate" -ProceedOnReboot $false

      $serverProfileKVM = @()

      $serverProfileKVM = $serverProfileDetail | Set-IntersightServerProfile 

       Start-Sleep -s 5

       Write-Host "Update policy bucket for UCS Server Profile $serverProfileName ....  `n" -ForegroundColor Green

       $serverProfileKVM | Set-IntersightServerProfile -ScheduledActions @($ScheduledActions11, $ScheduledActions21) -Action "Deploy" | Out-Null

       Write-Host "Re-Deploying UCS Server Profile $serverProfileName ....  `n" -ForegroundColor Yellow

       Start-Sleep -s 5

     }

**

Version used

Expected behavior Can the back-end handle the pause instead of adding it in the scripts?

Screenshots

Additional context Add any other context about the problem here.