Skip to content

Commit a35d25d

Browse files
author
unknown
committed
Fix New-AzureVM with VM image issue
1 parent 38a6477 commit a35d25d

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,22 @@ public void ValidateAvailableExtesnion(VirtualMachineExtensionImageContext exten
285285
Assert.IsFalse(string.IsNullOrEmpty(extension.Publisher));
286286
Assert.IsFalse(string.IsNullOrEmpty(extension.Version));
287287

288-
switch (extension.ExtensionName)
288+
if (! extension.IsJsonExtension)
289289
{
290-
case "DiagnosticsAgent":
291-
{
292-
Assert.IsFalse(string.IsNullOrEmpty(extension.PublicConfigurationSchema));
293-
break;
294-
}
295-
case "VMAccessAgent":
296-
{
297-
Assert.IsFalse(string.IsNullOrEmpty(extension.PublicConfigurationSchema));
298-
Assert.IsFalse(string.IsNullOrEmpty(extension.PrivateConfigurationSchema));
299-
break;
300-
}
290+
switch (extension.ExtensionName)
291+
{
292+
case "DiagnosticsAgent":
293+
{
294+
Assert.IsFalse(string.IsNullOrEmpty(extension.PublicConfigurationSchema));
295+
break;
296+
}
297+
case "VMAccessAgent":
298+
{
299+
Assert.IsFalse(string.IsNullOrEmpty(extension.PublicConfigurationSchema));
300+
Assert.IsFalse(string.IsNullOrEmpty(extension.PrivateConfigurationSchema));
301+
break;
302+
}
303+
}
301304
}
302305
}
303306

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,13 @@ private Management.Compute.Models.Role CreatePersistentVMRole(Tuple<Model.Persis
434434
ResourceExtensionReferences = persistentVM.ProvisionGuestAgent != null && persistentVM.ProvisionGuestAgent.Value ? Mapper.Map<List<ResourceExtensionReference>>(persistentVM.ResourceExtensionReferences) : null,
435435
VMImageName = isVMImage ? persistentVM.OSVirtualHardDisk.SourceImageName : null,
436436
MediaLocation = isVMImage ? persistentVM.OSVirtualHardDisk.MediaLink : null,
437-
VMImageInput = isVMImage ? PersistentVMHelper.MapVMImageInput(persistentVM.VMImageInput) : null
438437
};
439438

439+
if (persistentVM.VMImageInput != null)
440+
{
441+
result.VMImageInput = isVMImage ? PersistentVMHelper.MapVMImageInput(persistentVM.VMImageInput) : null;
442+
}
443+
440444
if (result.OSVirtualHardDisk != null)
441445
{
442446
result.OSVirtualHardDisk.IOType = null;

0 commit comments

Comments
 (0)