diff --git a/src/Automation/Automation.Test/ScenarioTests/AutomationTests.cs b/src/Automation/Automation.Test/ScenarioTests/AutomationTests.cs index b56c5c9301a3..66064b05acc8 100644 --- a/src/Automation/Automation.Test/ScenarioTests/AutomationTests.cs +++ b/src/Automation/Automation.Test/ScenarioTests/AutomationTests.cs @@ -77,7 +77,7 @@ public void TestAutomationStartUnpublishedRunbook() [Trait(Category.Service, Category.Automation)] public void TestAutomationRunbookWithParameter() { - TestRunner.RunTestScript("Test-RunbookWithParameter -runbookPath ScenarioTests\\Resources\\Test-PowershellRunbook.ps1 -type 'PowerShell' -parameters @{'nums'=@(1,2,3,4,5,6,7)} -expectedResult 28"); + TestRunner.RunTestScript("Test-RunbookWithParameter -runbookPath ScenarioTests\\Resources\\Test-PowershellRunbook.ps1 -type 'PowerShell' -parameters @{'nums'=@(1,2,3,4,5,6,7)} -expectedResult 28"); } [Fact(Skip = "Need x64 test framework.")] @@ -85,7 +85,7 @@ public void TestAutomationRunbookWithParameter() [Trait(Category.Service, Category.Automation)] public void TestAutomationPy2RunbookWithParameter() { - TestRunner.RunTestScript("Test-RunbookWithParameter -runbookPath ScenarioTests\\Resources\\TestPythonRunbook.py -type 'Python2' -parameters @{'param1'='1';'param2'='2';'param3'='3';'param4'='4';'param5'='5';'param6'='6';'param7'='7'} -expectedResult 28"); + TestRunner.RunTestScript("Test-RunbookWithParameter -runbookPath ScenarioTests\\Resources\\TestPythonRunbook.py -type 'Python2' -parameters @{'param1'='1';'param2'='2';'param3'='3';'param4'='4';'param5'='5';'param6'='6';'param7'='7'} -expectedResult 28"); } } } diff --git a/src/Automation/Automation.Test/ScenarioTests/AutomationTests.ps1 b/src/Automation/Automation.Test/ScenarioTests/AutomationTests.ps1 index 69ed29b537d0..7e1272bb1053 100644 --- a/src/Automation/Automation.Test/ScenarioTests/AutomationTests.ps1 +++ b/src/Automation/Automation.Test/ScenarioTests/AutomationTests.ps1 @@ -115,7 +115,6 @@ function Test-RunbookWithParameter $job = $automationAccount | Start-AzAutomationRunbook -Name $runbook.Name -Parameters $parameters WaitForJobStatus -Id $job.JobId -Status "Completed" $jobOutput = $automationAccount | Get-AzAutomationJobOutput -Id $job.JobId -Stream Output - [int]$Result = $jobOutput | Select-Object -Last 1 -ExpandProperty Summary Assert-AreEqual $expectedResult $Result diff --git a/src/Automation/Automation.Test/ScenarioTests/Resources/Test-PowershellRunbook.ps1 b/src/Automation/Automation.Test/ScenarioTests/Resources/Test-PowershellRunbook.ps1 index 7fcf8e6898ee..58731338065e 100644 --- a/src/Automation/Automation.Test/ScenarioTests/Resources/Test-PowershellRunbook.ps1 +++ b/src/Automation/Automation.Test/ScenarioTests/Resources/Test-PowershellRunbook.ps1 @@ -3,8 +3,6 @@ Param( ) Write-Output "Starting process" - $sum = ($nums | Measure-Object -Sum).Sum - Write-Output "Process completed" Write-Output $sum \ No newline at end of file diff --git a/src/Automation/Automation.Test/ScenarioTests/Resources/TestPythonRunbook.py b/src/Automation/Automation.Test/ScenarioTests/Resources/TestPythonRunbook.py index 35a9eb64d245..4c51b2139316 100644 --- a/src/Automation/Automation.Test/ScenarioTests/Resources/TestPythonRunbook.py +++ b/src/Automation/Automation.Test/ScenarioTests/Resources/TestPythonRunbook.py @@ -1,8 +1,8 @@ import sys print("Starting process") - sum = 0 + for i in range(1,len(sys.argv)): sum = sum + int(sys.argv[i]) diff --git a/src/Automation/Automation/ChangeLog.md b/src/Automation/Automation/ChangeLog.md index 036840a0011b..fbf15339d7e7 100644 --- a/src/Automation/Automation/ChangeLog.md +++ b/src/Automation/Automation/ChangeLog.md @@ -21,7 +21,9 @@ * Updated Get-AzAutomationJobOutputRecord to handle JSON and Text record values. - Fix for issue https://github.com/Azure/azure-powershell/issues/7977 - Fix for issue https://github.com/Azure/azure-powershell/issues/8600 - +* 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.2.1 * Fixed New-AzAutomationSoftwareUpdateConfiguration cmdlet bug for Inclusions. Now parameter IncludedKbNumber and IncludedPackageNameMask should work. * Bug fix for azure automation update management dynamic group diff --git a/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs b/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs index 5a83c735d57c..c7d0fa897954 100644 --- a/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs +++ b/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs @@ -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; diff --git a/src/Automation/Automation/Common/AutomationPSClientDSC.cs b/src/Automation/Automation/Common/AutomationPSClientDSC.cs index 5cfd13284583..6b6132f1cdb0 100644 --- a/src/Automation/Automation/Common/AutomationPSClientDSC.cs +++ b/src/Automation/Automation/Common/AutomationPSClientDSC.cs @@ -981,7 +981,9 @@ public CompilationJob StartCompilationJob(string resourceGroupName, string autom }; - var job = this.automationManagementClient.DscCompilationJob.Create(resourceGroupName, automationAccountName, Guid.NewGuid().ToString(), createJobParameters); + string jobId = Guid.NewGuid().ToString(); + + DscCompilationJob job = this.automationManagementClient.DscCompilationJob.BeginCreate(resourceGroupName, automationAccountName, jobId, createJobParameters); return new Model.CompilationJob(resourceGroupName, automationAccountName, job); }