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

Conversation

lwajswaj
Copy link
Contributor

This PR is a re-open of PR 8606. Regarding the last open question, I'm not sure if test cases can be written to cover both scenarios but I'm not good at writing them, maybe the core team can help me on that (@vladimir-shcherbakov).

CC: @MiYanni

Description

This PR fixed issue #8347; the root cause of this issue is a synchronous call to 'create' method which, when job gets suspended, it never releases control as the job hasn't completed. Not sure if this is by-design on the SDK or it's a bug. Using 'CreateAsync' fixes it but you cannot do a regular Wait() or GetWaiter() as the same behavior is repeated. Base on the documentation Compiling a DSC Configuration with Windows PowerShell, the original idea of this cmdlet seemed to be just starting the job but not waiting till it completed as it was the previous behavior. This PR changes Start-AzAutomationDscCompilationJob to just submit the compilation job but not waiting for its completion to return control, after this change this is how the usage looks like:

PS C:\Program Files\WindowsPowershellCore> Import-Module C:\Users\Leandro\Source\Repos\GitHub\lwajswaj\azure-powershell\artifacts\Debug\Az.Automation\Az.Automation.psd1
PS C:\Program Files\WindowsPowershellCore> Start-AzAutomationDscCompilationJob -ConfigurationName GoodConfig -ResourceGroupName <ResourceGroupName> -AutomationAccountName <AutomationAccountName>


ResourceGroupName      : <ResourceGroupName>
AutomationAccountName  : <AutomationAccountName>
Id                     : f6e2a35b-b076-4c98-b211-5975d5fa177e
CreationTime           : 22/02/2019 21:41:24 -03:00
Status                 : New
StatusDetails          : None
StartTime              :
EndTime                :
Exception              :
LastModifiedTime       : 22/02/2019 21:41:24 -03:00
LastStatusModifiedTime : 23/02/2019 00:41:24 +00:00
JobParameters          : {}
ConfigurationName      : GoodConfig



PS C:\Program Files\WindowsPowershellCore> Start-AzAutomationDscCompilationJob -ConfigurationName BadConfig -ResourceGroupName <ResourceGroupName> -AutomationAccountName <AutomationAccountName>


ResourceGroupName      : <ResourceGroupName>
AutomationAccountName  : <AutomationAccountName>
Id                     : f16827d2-3eab-4e1c-bbfc-673c6e4bf14c
CreationTime           : 22/02/2019 21:41:34 -03:00
Status                 : New
StatusDetails          : None
StartTime              :
EndTime                :
Exception              :
LastModifiedTime       : 22/02/2019 21:41:34 -03:00
LastStatusModifiedTime : 23/02/2019 00:41:34 +00:00
JobParameters          : {}
ConfigurationName      : BadConfig



PS C:\Program Files\WindowsPowershellCore> Get-AzAutomationDscCompilationJob -Id f16827d2-3eab-4e1c-bbfc-673c6e4bf14c -ResourceGroupName <ResourceGroupName> -AutomationAccountName <AutomationAccountName>


ResourceGroupName      : <ResourceGroupName>
AutomationAccountName  : <AutomationAccountName>
Id                     : f16827d2-3eab-4e1c-bbfc-673c6e4bf14c
CreationTime           : 22/02/2019 21:41:34 -03:00
Status                 : Suspended
StatusDetails          : None
StartTime              : 22/02/2019 21:42:11 -03:00
EndTime                :
Exception              : Exception calling "NewScriptBlock" with "1" argument(s): "At line:7 char:5
                         +     Import-DscResource -ModuleName 'PSDscResources12345'
                         +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         Could not find the module 'PSDscResources12345'." (At line:7 char:5
                         +     Import-DscResource -ModuleName 'PSDscResources12345'
                         +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         Could not find the module 'PSDscResources12345'.)
LastModifiedTime       : 22/02/2019 21:42:14 -03:00
LastStatusModifiedTime : 23/02/2019 00:42:14 +00:00
JobParameters          : {}
ConfigurationName      : BadConfig



PS C:\Program Files\WindowsPowershellCore> Get-AzAutomationDscCompilationJob -Id f6e2a35b-b076-4c98-b211-5975d5fa177e -ResourceGroupName <ResourceGroupName> -AutomationAccountName <AutomationAccountName>


ResourceGroupName      : <ResourceGroupName>
AutomationAccountName  : <AutomationAccountName>
Id                     : f6e2a35b-b076-4c98-b211-5975d5fa177e
CreationTime           : 22/02/2019 21:41:24 -03:00
Status                 : Completed
StatusDetails          : None
StartTime              : 22/02/2019 21:42:06 -03:00
EndTime                : 22/02/2019 21:42:15 -03:00
Exception              :
LastModifiedTime       : 22/02/2019 21:42:15 -03:00
LastStatusModifiedTime : 23/02/2019 00:42:15 +00:00
JobParameters          : {}
ConfigurationName      : GoodConfig

This PR introduces a behavior change in the cmdlet for which a breaking change warning has been included.

Checklist

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, would really like a test for this, but we cna file an issue on the service team to do thsi if they can just sign off on this fix.

src/Automation/Automation/Common/AutomationPSClientDSC.cs Outdated Show resolved Hide resolved
@markcowl markcowl added Service Attention This issue is responsible by Azure service team. Automation labels Apr 22, 2019
@markcowl
Copy link
Member

@jemex @vrdmr can one of you sign off on this fix (once the requested change is made)

@markcowl
Copy link
Member

markcowl commented May 2, 2019

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@NarayanThiru
Copy link
Member

Assigning to @avkaur as this fix is in DSC.

@avkaur
Copy link
Contributor

avkaur commented May 10, 2019

approved from dsc service side

@markcowl
Copy link
Member

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@lwajswaj
Copy link
Contributor Author

Not sure why, a few of my commits went away as I see the commits in my repo but not in the PR.... strange...

@lwajswaj
Copy link
Contributor Author

That's the reason of my last "touch" commit; just made silly modification to the files so they get tracked again

@MiYanni
Copy link
Contributor

MiYanni commented May 13, 2019

@lwajswaj I believe the changes you are looking for were merged already as part of #9031.

@MiYanni
Copy link
Contributor

MiYanni commented May 13, 2019

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@MiYanni
Copy link
Contributor

MiYanni commented May 14, 2019

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@MiYanni MiYanni dismissed markcowl’s stale review May 14, 2019 17:48

Review comments addressed and PR signed off by Automation.

@MiYanni MiYanni merged commit 781ec08 into Azure:master May 14, 2019
@lwajswaj lwajswaj deleted the fix/issue_8347 branch May 14, 2019 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants