Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Start-AzAutomationDscCompilationJob (Issue #8347) #8606

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Automation/Automation/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Update help for Import-AzAutomationDscNodeConfiguration
* Added configuration name validation to Import-AzAutomationDscConfiguration cmdlet
* Improved error handling for Import-AzAutomationDscConfiguration cmdlet
* Changed behavior for Start-AzAutomationDscCompilationJob to just start the job instead of waiting for its completion.
- Fix for issue https://github.com/Azure/azure-powershell/issues/8347

## Version 1.1.0
* Added support for Python 2 runbooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Properties;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System;
using System.Collections;
using System.Globalization;
Expand Down
19 changes: 18 additions & 1 deletion src/Automation/Automation/Common/AutomationPSClientDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,24 @@ public CompilationJob StartCompilationJob(string resourceGroupName, string autom

};

var job = this.automationManagementClient.DscCompilationJob.Create(resourceGroupName, automationAccountName, Guid.NewGuid().ToString(), createJobParameters);
string jobId = Guid.NewGuid().ToString();

var jobTask = this.automationManagementClient.DscCompilationJob.CreateAsync(resourceGroupName, automationAccountName, jobId, createJobParameters).GetAwaiter();
DscCompilationJob job = null;

do
{
System.Threading.Thread.Sleep(1000);

try
{
job = this.automationManagementClient.DscCompilationJob.Get(resourceGroupName, automationAccountName, jobId);
}
catch
{
job = null;
}
} while (job == null);

return new Model.CompilationJob(resourceGroupName, automationAccountName, job);
}
Expand Down