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) #9030

Merged
merged 14 commits into from
May 14, 2019
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ 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.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[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");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Param(
)

Write-Output "Starting process"

$sum = ($nums | Measure-Object -Sum).Sum

Write-Output "Process completed"
Write-Output $sum
Original file line number Diff line number Diff line change
@@ -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])

Expand Down
4 changes: 3 additions & 1 deletion src/Automation/Automation/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
4 changes: 3 additions & 1 deletion src/Automation/Automation/Common/AutomationPSClientDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down