Skip to content

Commit f697a1e

Browse files
committed
Expose SubStatus for Extension instance view
1 parent 36ff79a commit f697a1e

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ function Test-VirtualMachineExtension
139139
Assert-AreEqual $ext.ResourceGroupName $rgname;
140140
Assert-NotNull $ext.ProvisioningState;
141141
Assert-NotNull $ext.Statuses;
142+
Assert-NotNull $ext.SubStatuses;
142143

143144
# Remove Extension
144145
Remove-AzureRmVMExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Force;

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/VirtualMachineDscExtensionContext.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,5 @@ public class VirtualMachineDscExtensionContext : PSVirtualMachineExtension
2525
public string ModulesUrl { get; set; }
2626
public string ConfigurationFunction { get; set; }
2727
public Hashtable Properties { get; set; }
28-
29-
[JsonIgnore]
30-
public string StatusesText
31-
{
32-
get
33-
{
34-
var status = JsonConvert.SerializeObject(Statuses, Formatting.Indented);
35-
return "null".Equals(status) ? String.Empty : status;
36-
}
37-
}
3828
}
3929
}

src/ResourceManager/Compute/Commands.Compute/Models/PSVirtualMachineExtension.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Management.Compute.Models;
1616
using System.Collections.Generic;
17+
using Newtonsoft.Json;
1718

1819
namespace Microsoft.Azure.Commands.Compute.Models
1920
{
@@ -42,6 +43,21 @@ public class PSVirtualMachineExtension
4243
public string ProvisioningState { get; set; }
4344

4445
public IList<InstanceViewStatus> Statuses { get; set; }
46+
47+
[JsonIgnore]
48+
public string StatusesText
49+
{
50+
get { return JsonConvert.SerializeObject(Statuses, Formatting.Indented); }
51+
}
52+
53+
public IList<InstanceViewStatus> SubStatuses { get; set; }
54+
55+
[JsonIgnore]
56+
public string SubStatusesText
57+
{
58+
get { return JsonConvert.SerializeObject(SubStatuses, Formatting.Indented); }
59+
}
60+
4561
}
4662

4763
public static class PSVirtualMachineExtensionConversions
@@ -71,7 +87,8 @@ public static PSVirtualMachineExtension ToPSVirtualMachineExtension(this Virtual
7187
PublicSettings = ext == null ? null : ext.Settings,
7288
ProtectedSettings = ext == null ? null : ext.ProtectedSettings,
7389
ProvisioningState = ext == null ? null : ext.ProvisioningState,
74-
Statuses = ext == null || ext.InstanceView == null ? null : ext.InstanceView.Statuses
90+
Statuses = ext == null || ext.InstanceView == null ? null : ext.InstanceView.Statuses,
91+
SubStatuses = ext == null || ext.InstanceView == null ? null : ext.InstanceView.SubStatuses,
7592
};
7693

7794
return result;

0 commit comments

Comments
 (0)