Skip to content

Update Import-AzureRMAutomationRunbook command to support Python Runbooks #5000

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

Merged
merged 6 commits into from
Dec 1, 2017

Conversation

rdbartram
Copy link
Contributor

@rdbartram rdbartram commented Nov 16, 2017

Description


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@azuresdkci
Copy link

Can one of the admins verify this patch?

@cormacpayne
Copy link
Member

@rdbartram Hey Ryan, thanks for opening this PR!

@vrdmr Hey Varad, would you mind reviewing this PR?

@cormacpayne
Copy link
Member

@azuresdkci add to whitelist

@vrdmr
Copy link
Member

vrdmr commented Nov 16, 2017

Adding @Diastro to review this.

@vrdmr vrdmr requested a review from Diastro November 16, 2017 22:07
Diastro
Diastro previously approved these changes Nov 16, 2017
@@ -66,6 +66,7 @@ public class ImportAzureAutomationRunbook : AzureAutomationBaseCmdlet
Constants.RunbookType.PowerShellWorkflow,
Constants.RunbookType.GraphicalPowerShellWorkflow,
Constants.RunbookType.Graph,
Constants.RunbookType.Python,
Copy link

Choose a reason for hiding this comment

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

Might be a good idea to call this Python2 (the backend already makes the difference between Py2 and Py3).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Diastro,I thought the same, my only concern was there is no reference to the powershell version, Core or otherwise. So I assumed when the day came that Python 3 was supported, Python 2 would be deprecated. I can change it to Python2 before you accept the change. What does everyone else think?

Copy link
Member

Choose a reason for hiding this comment

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

@Diastro gentle ping

I think we should also look into test coverage around this so that we will know immediately when Python 2 support is deprecated and we can move to Python 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cormacpayne are we doing integration testing with this module? How would you recommend detecting whether the API has deprecated Python2 or not?

Copy link
Member

Choose a reason for hiding this comment

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

@rdbartram we have some live tests we run in Azure Automation, so we could add test coverage there to know when the call no longer works. We also should add a scenario test that runs during our regular CI to make sure this functionality is working correctly. @vrdmr @Diastro it doesn't look like we have any tests around the Import-AzureRmAutomationRunbook cmdlet, are we able to add one for this functionality?

Copy link

Choose a reason for hiding this comment

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

@rdbartram Sorry for the delay this slipped through my notifications.
I don't think we will deprecate Python2 if Python3 becomes available (we almost threat the as different languages to some extent). For now I think we can leave it as it (the variable name is really just an internal implementation detail at this point and can be refactored later). @vrdmr can comment on the test question.

Copy link

Choose a reason for hiding this comment

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

@cormacpayne I just synced with @vrdmr and you can open a task against @najams he's the owner for this area of our RP. We are waiting for our SDK to be migrated from Hyak to Swagger which will happen in December (this is when we will add test for this).
In the mean time can we let this go in please?

@cormacpayne
Copy link
Member

@rdbartram Hey Ryan, would you mind updating the Automation change log (underneath the ## Current Release header) with a snippet about the change you are making in this PR?

cormacpayne
cormacpayne previously approved these changes Nov 29, 2017
@cormacpayne
Copy link
Member

@vrdmr @Diastro any additional comments from your side?

@cormacpayne cormacpayne assigned vrdmr and Diastro and unassigned rdbartram Nov 29, 2017
@@ -23,7 +23,7 @@ Import-AzureRmAutomationRunbook [-Path] <String> [-Description <String>] [-Name
## DESCRIPTION
The **Import-AzureRmAutomationRunbook** cmdlet imports an Azure Automation runbook. Specify the
path to a wps_2 script (.ps1 ) file to import for wps_2 and wps_2 Workflow runbooks, or to a
graphical runbook (.graphrunbook) file for graphical runbooks. The name of the file becomes the
graphical runbook (.graphrunbook) file for graphical runbooks. (.py) files are required when importing python2 scripts The name of the file becomes the
Copy link

Choose a reason for hiding this comment

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

Sorry for being picky, punctuation seems weird here. Also, I believe the extension requirement is true for other runbook type too no? Also can you remove the extra space from (.ps1 ) please.

Suggestion :
"Specify the path to a wps_2 script (.ps1) file to import for wps_2 and wps_2 Workflow runbooks, or to a graphical runbook (.graphrunbook) file for graphical runbooks, or to a python 2 script (.py) file for python 2 runbooks... "

Thoughts?

definition that matches the name of the file.
The **Import-AzureRmAutomationRunbook** cmdlet imports an Azure Automation runbook. Specify the
path to a wps_2 script (.ps1) file to import for wps_2 and wps_2 Workflow runbooks,
or to a graphical runbook (.graphrunbook) file for graphical runbooks, or to a python 2 script (.py) file for python 2 runbooks.
Copy link

Choose a reason for hiding this comment

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

Can you remove the 'or' before the 'to a graphical runbook' please? Sorry I might have added it in my suggestion but 2 'or' doesnt make sens.
Singing off.

Thanks!

Diastro
Diastro previously approved these changes Nov 30, 2017
@cormacpayne
Copy link
Member

@cormacpayne
Copy link
Member

cormacpayne commented Nov 30, 2017

Adding test for this functionality will be handled by @vrdmr or @Diastro in the next milestone

@cormacpayne cormacpayne merged commit 4c68486 into Azure:preview Dec 1, 2017
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.

7 participants