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

Conversation

lwajswaj
Copy link
Contributor

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

@cormacpayne
Copy link
Member

@lwajswaj Hey Leandro, thanks for the contribution!

@avkaur @vrdmr would one of you be able to take a look at these changes?

@lwajswaj
Copy link
Contributor Author

lwajswaj commented Mar 1, 2019

Any update on this PR review?

@cormacpayne
Copy link
Member

@lwajswaj the proper contacts from the Automation team have been contacted offline -- @avkaur @mgreenegit @nitinbps

@mgreenegit
Copy link
Member

Just FYI, I opened a work item to track this for our team to make sure we get this reviewed.

avkaur
avkaur previously approved these changes Mar 9, 2019
@vladimir-shcherbakov
Copy link
Contributor

@lwajswaj What is the status of the PR? Are you still waiting for the @vrdmr review?

vrdmr
vrdmr previously approved these changes Mar 11, 2019
@lwajswaj
Copy link
Contributor Author

@vladimir-shcherbakov, 2 out of the 4 reviewers approved it. However, I don't have rights to merge it as I'm not an authorized user.

@lwajswaj lwajswaj dismissed stale reviews from vrdmr and avkaur via 917fe3d March 13, 2019 23:29
@vladimir-shcherbakov
Copy link
Contributor

vladimir-shcherbakov commented Mar 14, 2019

@lwajswaj Is it possible for you to cover basic scenarios with tests?

@vladimir-shcherbakov
Copy link
Contributor

@lwajswaj Ping on the comments above.

@MiYanni
Copy link
Contributor

MiYanni commented Mar 28, 2019

@lwajswaj No activity for 2 weeks. Closing. Feel free to reopen when you have time to address the comments above.

@MiYanni MiYanni closed this Mar 28, 2019
@lwajswaj
Copy link
Contributor Author

Hello, I've been with some business trips + vacations and it was not possible to stay on top of this PR. How should I proceed? opening a new one or can this one be re-open?

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.

8 participants