Skip to content

Fix bad revert #904

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 3 commits into from Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ public void TestGetService()
{
//when service name is passed as argument in the cmdlet
getAzureVmDscExtensionStatusCmdlet.GetService(ServiceName, null);
Assert.Equal(ServiceName, getAzureVmDscExtensionStatusCmdlet.Service);
Assert.Equal(ServiceName, getAzureVmDscExtensionStatusCmdlet.ServiceName);

//when vm object is passed as argument in the cmdlet
getAzureVmDscExtensionStatusCmdlet.GetService("", GetAzureVM(ServiceName, ServiceName));
Assert.Equal(ServiceName, getAzureVmDscExtensionStatusCmdlet.Service);
Assert.Equal(ServiceName, getAzureVmDscExtensionStatusCmdlet.ServiceName);
}

[Fact]
public void TestGetVirtualMachineDscStatusContextListWithServiceName()
{
getAzureVmDscExtensionStatusCmdlet.Service = ServiceName;
getAzureVmDscExtensionStatusCmdlet.ServiceName = ServiceName;

// service has multiple vm's
var roles = new List<NSM.Role> {CreateRole("dscmachine01"), CreateRole("dscmachine02")};
Expand All @@ -59,7 +59,7 @@ public void TestGetVirtualMachineDscStatusContextListWithServiceName()
[Fact]
public void TestGetVirtualMachineDscStatusContextListWithServiceNameAndVmName()
{
getAzureVmDscExtensionStatusCmdlet.Service = ServiceName;
getAzureVmDscExtensionStatusCmdlet.ServiceName = ServiceName;
getAzureVmDscExtensionStatusCmdlet.Name = "dscmachine01";

// service has multiple vm's
Expand All @@ -84,7 +84,7 @@ public void TestGetVirtualMachineDscStatusContextListWithServiceNameAndVmName()
[Fact]
public void TestGetVirtualMachineDscStatusContextListWithServiceNameAndIncorrectVmName()
{
getAzureVmDscExtensionStatusCmdlet.Service = ServiceName;
getAzureVmDscExtensionStatusCmdlet.ServiceName = ServiceName;
getAzureVmDscExtensionStatusCmdlet.Name = "some-blah";

// service has multiple vm's
Expand All @@ -108,7 +108,7 @@ public void TestGetVirtualMachineDscStatusContextListWithServiceNameAndIncorrect
[Fact]
public void TestGetVirtualMachineDscStatusContextListWithVm()
{
getAzureVmDscExtensionStatusCmdlet.Service = ServiceName;
getAzureVmDscExtensionStatusCmdlet.ServiceName = ServiceName;
getAzureVmDscExtensionStatusCmdlet.VmName = "dscmachine02";

// service has multiple vm's
Expand All @@ -127,7 +127,7 @@ public void TestGetVirtualMachineDscStatusContextListWithVm()
[Fact]
public void TestCreateDscStatusContext()
{
getAzureVmDscExtensionStatusCmdlet.Service = ServiceName;
getAzureVmDscExtensionStatusCmdlet.ServiceName = ServiceName;

var roles = new List<NSM.Role> {CreateRole("dscmachine02")};
var roleInstances = new List<NSM.RoleInstance> {CreateRoleInstance("dscmachine02")};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class GetAzureVmDscExtensionStatusCommand : IaaSDeploymentManagementCmdle
protected const string GetStatusByServiceAndVmNameParamSet = "GetStatusByServiceAndVMName";
protected const string GetStatusByVmParamSet = "GetStatusByVM";

internal string Service;
internal string VmName;

/// <summary>
Expand All @@ -94,6 +93,7 @@ protected override void ExecuteCommand()
{
ServiceManagementProfile.Initialize();
GetService(ServiceName, VM);

base.ExecuteCommand();

if (CurrentDeploymentNewSM == null)
Expand All @@ -118,7 +118,7 @@ internal void GetService(String serviceName, IPersistentVM vm)
{
if (!string.IsNullOrEmpty(serviceName))
{
Service = serviceName;
this.ServiceName = serviceName;
}
else
{
Expand All @@ -127,7 +127,7 @@ internal void GetService(String serviceName, IPersistentVM vm)
if (vmRoleContext == null)
return;

Service = vmRoleContext.ServiceName;
this.ServiceName = vmRoleContext.ServiceName;
VmName = vmRoleContext.Name;
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ internal VirtualMachineDscExtensionStatusContext CreateDscStatusContext(NSM.Role

var dscStatusContext = new VirtualMachineDscExtensionStatusContext
{
ServiceName = Service,
ServiceName = this.ServiceName,
Name = vmRole == null ? string.Empty : vmRole.RoleName,
Status = extensionSettingStatus.Status ?? string.Empty,
StatusCode = extensionSettingStatus.Code ?? -1,
Expand Down