Skip to content

Commit

Permalink
Merge pull request #9030 from lwajswaj/fix/issue_8347
Browse files Browse the repository at this point in the history
Fix Start-AzAutomationDscCompilationJob (Issue #8347)
  • Loading branch information
MiYanni authored May 14, 2019
2 parents 17c09b8 + 6639385 commit 781ec08
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
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

0 comments on commit 781ec08

Please sign in to comment.