From 78d68880c01395efb693fa7f6e0fe34f26a04096 Mon Sep 17 00:00:00 2001 From: Oskar Wycislak Date: Wed, 2 May 2018 20:18:03 +0200 Subject: [PATCH] Randomize osDisk name for Azure Managed Image builds. This fixes #6115 --- builder/azure/arm/TestVirtualMachineDeployment05.approved.txt | 2 +- .../arm/template_factory_test.TestPlanInfo01.approved.json | 2 +- .../arm/template_factory_test.TestPlanInfo02.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment03.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment04.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment05.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment06.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment07.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment08.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment09.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment10.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment11.approved.json | 2 +- ..._factory_test.TestVirtualMachineDeployment12.approved.json | 2 +- builder/azure/common/template/TestBuildLinux02.approved.txt | 2 +- builder/azure/common/template/template_builder.go | 4 +--- .../template_builder_test.TestBuildLinux00.approved.json | 2 +- .../template_builder_test.TestBuildLinux01.approved.json | 2 +- .../template_builder_test.TestBuildLinux02.approved.json | 2 +- .../template_builder_test.TestBuildWindows00.approved.json | 2 +- .../template_builder_test.TestBuildWindows01.approved.json | 2 +- .../template_builder_test.TestBuildWindows02.approved.json | 2 +- 21 files changed, 21 insertions(+), 23 deletions(-) diff --git a/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt b/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt index 8a8a5d4d4..31532ddbe 100644 --- a/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt +++ b/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt @@ -90,7 +90,7 @@ "image": { "uri": "https://localhost/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json b/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json index 1d2ef2207..392dc0ec9 100644 --- a/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json +++ b/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json @@ -167,7 +167,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json b/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json index bc3ef83ef..b29616711 100644 --- a/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json +++ b/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json @@ -171,7 +171,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json index 2a9a429e5..edb21ca39 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json @@ -144,7 +144,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json index 215acda04..ae52ff483 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json @@ -141,7 +141,7 @@ "image": { "uri": "https://localhost/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json index c7a73e7ad..5c78f287a 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json @@ -102,7 +102,7 @@ "image": { "uri": "https://localhost/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json index 258fd9261..04ce31e33 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json @@ -156,7 +156,7 @@ "image": { "uri": "https://localhost/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json index 8d7101cfe..a3b278f1e 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json @@ -142,7 +142,7 @@ "image": { "uri": "https://localhost/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json index ae0700880..8e61c0055 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json @@ -144,7 +144,7 @@ "managedDisk": { "storageAccountType": "Standard_LRS" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux" } } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json index a7baa806f..e64f16913 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json @@ -147,7 +147,7 @@ "managedDisk": { "storageAccountType": "Standard_LRS" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux" } } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json index 8c27336c5..dfde04a08 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json @@ -125,7 +125,7 @@ "managedDisk": { "storageAccountType": "Standard_LRS" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux" } } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json index 4776d5344..bf94c8581 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json @@ -156,7 +156,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json index 25449da24..6f6ef5749 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json @@ -159,7 +159,7 @@ "managedDisk": { "storageAccountType": "Standard_LRS" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux" } } diff --git a/builder/azure/common/template/TestBuildLinux02.approved.txt b/builder/azure/common/template/TestBuildLinux02.approved.txt index c2533dd2d..97aad4de1 100644 --- a/builder/azure/common/template/TestBuildLinux02.approved.txt +++ b/builder/azure/common/template/TestBuildLinux02.approved.txt @@ -103,7 +103,7 @@ "storageProfile": { "osDisk": { "osType": "Linux", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" }, diff --git a/builder/azure/common/template/template_builder.go b/builder/azure/common/template/template_builder.go index 3067c906e..3180a81a4 100644 --- a/builder/azure/common/template/template_builder.go +++ b/builder/azure/common/template/template_builder.go @@ -111,7 +111,6 @@ func (s *TemplateBuilder) SetManagedDiskUrl(managedImageId string, storageAccoun profile.ImageReference = &compute.ImageReference{ ID: &managedImageId, } - profile.OsDisk.Name = to.StringPtr("osdisk") profile.OsDisk.OsType = s.osType profile.OsDisk.CreateOption = compute.FromImage profile.OsDisk.Vhd = nil @@ -136,7 +135,6 @@ func (s *TemplateBuilder) SetManagedMarketplaceImage(location, publisher, offer, Version: &version, //ID: &imageID, } - profile.OsDisk.Name = to.StringPtr("osdisk") profile.OsDisk.OsType = s.osType profile.OsDisk.CreateOption = compute.FromImage profile.OsDisk.Vhd = nil @@ -583,7 +581,7 @@ const BasicTemplate = `{ }, "storageProfile": { "osDisk": { - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" }, diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json index 5a4b69427..85986d344 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json @@ -144,7 +144,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json index d23117b48..d98871cb8 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json @@ -141,7 +141,7 @@ "image": { "uri": "http://azure/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json index 68d1bc427..d7dd46a45 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json @@ -103,7 +103,7 @@ "image": { "uri": "http://azure/custom.vhd" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Linux", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json index cbf46d3e8..e1d511f40 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json @@ -158,7 +158,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json index c660dcd75..881500148 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json @@ -183,7 +183,7 @@ "managedDisk": { "storageAccountType": "Premium_LRS" }, - "name": "osdisk", + "name": "[parameters('osDiskName')]", "osType": "Windows" } } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json index 0507771ee..7c44163c3 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json @@ -174,7 +174,7 @@ "osDisk": { "caching": "ReadWrite", "createOption": "FromImage", - "name": "osdisk", + "name": "[parameters('osDiskName')]", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" }