Skip to content

Commit 4c68486

Browse files
authored
Merge pull request Azure#5000 from rdbartram/preview
Update Import-AzureRMAutomationRunbook command to support Python Runbooks
2 parents e9e63af + 06add2c commit 4c68486

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

src/ResourceManager/Automation/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Update to Import-AzureRMAutomationRunbook
22+
- Support is now being provided for Python2 runbooks
2123

2224
## Version 4.0.0
2325
* Add support for online help

src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationRunbook.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ----------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
22
//
33
// Copyright Microsoft Corporation
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,6 +66,7 @@ public class ImportAzureAutomationRunbook : AzureAutomationBaseCmdlet
6666
Constants.RunbookType.PowerShellWorkflow,
6767
Constants.RunbookType.GraphicalPowerShellWorkflow,
6868
Constants.RunbookType.Graph,
69+
Constants.RunbookType.Python2,
6970
IgnoreCase = true)]
7071
[ValidateNotNullOrEmpty]
7172
public string Type { get; set; }

src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ----------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
22
//
33
// Copyright Microsoft Corporation
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -489,6 +489,9 @@ public Runbook ImportRunbook(string resourceGroupName, string automationAccountN
489489
StringComparison.OrdinalIgnoreCase) &&
490490
0 !=
491491
string.Compare(fileExtension, Constants.SupportedFileExtensions.Graph,
492+
StringComparison.OrdinalIgnoreCase) &&
493+
0 !=
494+
string.Compare(fileExtension, Constants.SupportedFileExtensions.Python,
492495
StringComparison.OrdinalIgnoreCase))
493496
{
494497
throw new ResourceCommonException(typeof(Runbook),

src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ----------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
22
//
33
// Copyright Microsoft Corporation
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -85,13 +85,17 @@ public static class RunbookType
8585
public const string GraphicalPowerShell = "GraphicalPowerShell";
8686

8787
public const string GraphicalPowerShellWorkflow = "GraphicalPowerShellWorkflow";
88+
89+
public const string Python2 = "Python2";
8890
}
8991

9092
public static class SupportedFileExtensions
9193
{
9294
public const string PowerShellScript = ".ps1";
9395

9496
public const string Graph = ".graphrunbook";
97+
98+
public const string Python = ".py";
9599
}
96100
}
97101
}

src/ResourceManager/Automation/Commands.Automation/help/Import-AzureRMAutomationRunbook.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ Import-AzureRmAutomationRunbook [-Path] <String> [-Description <String>] [-Name
2121
```
2222

2323
## DESCRIPTION
24-
The **Import-AzureRmAutomationRunbook** cmdlet imports an Azure Automation runbook. Specify the
25-
path to a wps_2 script (.ps1 ) file to import for wps_2 and wps_2 Workflow runbooks, or to a
26-
graphical runbook (.graphrunbook) file for graphical runbooks. The name of the file becomes the
27-
name of the runbook. For wps_2 Workflow runbooks, the script must contain a single wps_2 Workflow
28-
definition that matches the name of the file.
24+
The **Import-AzureRmAutomationRunbook** cmdlet imports an Azure Automation runbook. Specify the
25+
path to a wps_2 script (.ps1) file to import for wps_2 and wps_2 Workflow runbooks,
26+
(.graphrunbook) file for graphical runbooks, or (.py) file for python 2 runbooks.
27+
For wps_2 Workflow runbooks, the script must contain a single wps_2 Workflow definition that matches the name of the file.
2928

3029
## EXAMPLES
3130

@@ -218,6 +217,7 @@ Valid values are:
218217
- PowerShellWorkflow
219218
- GraphicalPowerShellWorkflow
220219
- Graph
220+
- Python2
221221
222222
The value Graph is obsolete.
223223
It is equivalent to GraphicalPowerShellWorkflow.
@@ -226,7 +226,7 @@ It is equivalent to GraphicalPowerShellWorkflow.
226226
Type: String
227227
Parameter Sets: (All)
228228
Aliases:
229-
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph
229+
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python
230230

231231
Required: True
232232
Position: Named

0 commit comments

Comments
 (0)