Skip to content

Commit 3b62133

Browse files
committed
fixed bugs in dsc
1 parent 0b2c8e5 commit 3b62133

File tree

7 files changed

+416
-314
lines changed

7 files changed

+416
-314
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class GetAzureAutomationDscConfiguration : AzureAutomationBaseCmdlet
3131
/// <summary>
3232
/// Gets or sets the configuration name.
3333
/// </summary>
34-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Position = 2, Mandatory = true, ValueFromPipeline = true, HelpMessage = "The configuration name.")]
34+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration name.")]
3535
[Alias("ConfigurationName")]
3636
[ValidateNotNullOrEmpty]
3737
public string Name { get; set; }

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ public class GetAzureAutomationDscNode : AzureAutomationBaseCmdlet
4242
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")]
4343
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfiguration, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")]
4444
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")]
45-
[ValidateSet("Any", "Compliant", "NotCompliant", "Failed", "Pending", "Received", "Unresponsive")]
45+
[ValidateSet("Compliant", "NotCompliant", "Failed", "Pending", "Received", "Unresponsive")]
4646
public DscNodeStatus Status { get; set; }
4747

4848
/// <summary>
4949
/// Gets or sets the node name.
5050
/// </summary>
51-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = true, ValueFromPipeline = true, HelpMessage = "The node name.")]
51+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The node name.")]
5252
[ValidateNotNullOrEmpty]
53+
[Alias("NodeName")]
5354
public string Name { get; set; }
5455

5556
/// <summary>
5657
/// Gets or sets the nodeconfiguration name.
5758
/// </summary>
5859
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfiguration, Mandatory = true, HelpMessage = "Filter dsc nodes based on their node configuration name.")]
59-
[ValidateNotNullOrEmpty]
6060
public string NodeConfigurationName { get; set; }
6161

6262
/// <summary>
@@ -75,9 +75,9 @@ public override void ExecuteCmdlet()
7575
IEnumerable<DscNode> ret = null;
7676

7777
var nodeStatus = this.Status.ToString();
78-
if (nodeStatus.Equals(DscNodeStatus.Any))
78+
if (nodeStatus.Equals("0"))
7979
{
80-
nodeStatus = string.Empty;
80+
nodeStatus = null;
8181
}
8282

8383
if (this.ParameterSetName == AutomationCmdletParameterSets.ById)

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ public class GetAzureAutomationDscNodeConfiguration : AzureAutomationBaseCmdlet
4040
/// <summary>
4141
/// Gets or sets the runbook name of the job.
4242
/// </summary>
43-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = true, HelpMessage = "The configuration name.")]
43+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "The configuration name.")]
4444
public string ConfigurationName { get; set; }
4545

4646
/// <summary>
4747
/// Gets or sets the status of a job.
4848
/// </summary>
4949
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "Filter node configurations by RollupStatus.")]
50-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfigurationName, Mandatory = false, HelpMessage = "Filter node configurations by RollupStatus.")]
5150
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter node configurations by RollupStatus.")]
5251
[ValidateSet("Good", "Bad")]
5352
public string RollupStatus { get; set; }
@@ -60,9 +59,8 @@ protected override void AutomationExecuteCmdlet()
6059
{
6160
IEnumerable<NodeConfiguration> nodeConfigurations;
6261

63-
if (this.Name != null && !Guid.Empty.Equals(this.Name))
62+
if (this.Name != null)
6463
{
65-
// ByJobId
6664
nodeConfigurations = new List<NodeConfiguration> { this.AutomationClient.GetNodeConfiguration(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.RollupStatus) };
6765
}
6866
else if (this.ConfigurationName != null)

0 commit comments

Comments
 (0)