Added acceptance tests for DTL. Fixed couple of issues with DTL root resource group not set to new directory
This commit is contained in:
parent
69015b1870
commit
b7d85b8a23
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "packer-acceptance-test"
|
||||||
|
},
|
||||||
|
"regionId": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "southcentralus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2018-10-15-preview",
|
||||||
|
"name": "[parameters('name')]",
|
||||||
|
"type": "Microsoft.DevTestLab/labs",
|
||||||
|
"location": "[parameters('regionId')]",
|
||||||
|
"tags": {
|
||||||
|
"env": "packer"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"labStorageType": "Premium"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2018-10-15-preview",
|
||||||
|
"name": "LabVmsShutdown",
|
||||||
|
"location": "[parameters('regionId')]",
|
||||||
|
"type": "schedules",
|
||||||
|
"dependsOn": [
|
||||||
|
"[resourceId('Microsoft.DevTestLab/labs', parameters('name'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"status": "Enabled",
|
||||||
|
"timeZoneId": "Pacific Standard Time",
|
||||||
|
"dailyRecurrence": {
|
||||||
|
"time": "1900"
|
||||||
|
},
|
||||||
|
"taskType": "LabVmsShutdownTask",
|
||||||
|
"notificationSettings": {
|
||||||
|
"status": "Disabled",
|
||||||
|
"timeInMinutes": 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2018-10-15-preview",
|
||||||
|
"name": "[concat('Dtl', parameters('name'))]",
|
||||||
|
"type": "virtualNetworks",
|
||||||
|
"location": "[parameters('regionId')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[resourceId('Microsoft.DevTestLab/labs', parameters('name'))]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2018-10-15-preview",
|
||||||
|
"name": "Public Environment Repo",
|
||||||
|
"type": "artifactSources",
|
||||||
|
"location": "[parameters('regionId')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[resourceId('Microsoft.DevTestLab/labs', parameters('name'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"status": "Enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -301,7 +301,6 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) {
|
||||||
stateBag.Put(constants.ArmIsManagedImage, b.config.isManagedImage())
|
stateBag.Put(constants.ArmIsManagedImage, b.config.isManagedImage())
|
||||||
stateBag.Put(constants.ArmManagedImageResourceGroupName, b.config.ManagedImageResourceGroupName)
|
stateBag.Put(constants.ArmManagedImageResourceGroupName, b.config.ManagedImageResourceGroupName)
|
||||||
stateBag.Put(constants.ArmManagedImageName, b.config.ManagedImageName)
|
stateBag.Put(constants.ArmManagedImageName, b.config.ManagedImageName)
|
||||||
stateBag.Put(constants.ArmAsyncResourceGroupDelete, b.config.AsyncResourceGroupDelete)
|
|
||||||
if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
if b.config.isManagedImage() && b.config.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
||||||
stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, b.config.SharedGalleryDestination.SigDestinationResourceGroup)
|
stateBag.Put(constants.ArmManagedImageSigPublishResourceGroup, b.config.SharedGalleryDestination.SigDestinationResourceGroup)
|
||||||
stateBag.Put(constants.ArmManagedImageSharedGalleryName, b.config.SharedGalleryDestination.SigDestinationGalleryName)
|
stateBag.Put(constants.ArmManagedImageSharedGalleryName, b.config.SharedGalleryDestination.SigDestinationGalleryName)
|
||||||
|
|
|
@ -7,13 +7,18 @@ package dtl
|
||||||
// * ARM_CLIENT_SECRET
|
// * ARM_CLIENT_SECRET
|
||||||
// * ARM_SUBSCRIPTION_ID
|
// * ARM_SUBSCRIPTION_ID
|
||||||
// * ARM_OBJECT_ID
|
// * ARM_OBJECT_ID
|
||||||
// * ARM_STORAGE_ACCOUNT
|
|
||||||
//
|
//
|
||||||
// The subscription in question should have a resource group
|
// The subscription in question should have a resource group
|
||||||
// called "packer-acceptance-test" in "South Central US" region. The
|
// called "packer-acceptance-test" in "South Central US" region.
|
||||||
// storage account refered to in the above variable should
|
// This also requires a Devtest lab to be created with "packer-acceptance-test"
|
||||||
// be inside this resource group and in "South Central US" as well.
|
// name in "South Central US region. This can be achieved using the following
|
||||||
//
|
// az cli commands "
|
||||||
|
// az group create --name packer-acceptance-test --location "South Central US"
|
||||||
|
// az deployment group create \
|
||||||
|
// --name ExampleDeployment \
|
||||||
|
// --resource-group packer-acceptance-test \
|
||||||
|
// --template-file acceptancetest.json \
|
||||||
|
|
||||||
// In addition, the PACKER_ACC variable should also be set to
|
// In addition, the PACKER_ACC variable should also be set to
|
||||||
// a non-empty value to enable Packer acceptance tests and the
|
// a non-empty value to enable Packer acceptance tests and the
|
||||||
// options "-v -timeout 90m" should be provided to the test
|
// options "-v -timeout 90m" should be provided to the test
|
||||||
|
@ -23,9 +28,6 @@ package dtl
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,30 +40,7 @@ func TestBuilderAcc_ManagedDisk_Windows(t *testing.T) {
|
||||||
Template: testBuilderAccManagedDiskWindows,
|
Template: testBuilderAccManagedDiskWindows,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
func TestBuilderAcc_ManagedDisk_Linux_Artifacts(t *testing.T) {
|
||||||
func TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group(t *testing.T) {
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Builder: &Builder{},
|
|
||||||
Template: testBuilderAccManagedDiskWindowsBuildResourceGroup,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuilderAcc_ManagedDisk_Windows_DeviceLogin(t *testing.T) {
|
|
||||||
if os.Getenv(DeviceLoginAcceptanceTest) == "" {
|
|
||||||
t.Skip(fmt.Sprintf(
|
|
||||||
"Device Login Acceptance tests skipped unless env '%s' set, as its requires manual step during execution",
|
|
||||||
DeviceLoginAcceptanceTest))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Builder: &Builder{},
|
|
||||||
Template: testBuilderAccManagedDiskWindowsDeviceLogin,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuilderAcc_ManagedDisk_Linux(t *testing.T) {
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
builderT.Test(t, builderT.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Builder: &Builder{},
|
Builder: &Builder{},
|
||||||
|
@ -69,36 +48,6 @@ func TestBuilderAcc_ManagedDisk_Linux(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderAcc_ManagedDisk_Linux_DeviceLogin(t *testing.T) {
|
|
||||||
if os.Getenv(DeviceLoginAcceptanceTest) == "" {
|
|
||||||
t.Skip(fmt.Sprintf(
|
|
||||||
"Device Login Acceptance tests skipped unless env '%s' set, as its requires manual step during execution",
|
|
||||||
DeviceLoginAcceptanceTest))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Builder: &Builder{},
|
|
||||||
Template: testBuilderAccManagedDiskLinuxDeviceLogin,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuilderAcc_Blob_Windows(t *testing.T) {
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Builder: &Builder{},
|
|
||||||
Template: testBuilderAccBlobWindows,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuilderAcc_Blob_Linux(t *testing.T) {
|
|
||||||
builderT.Test(t, builderT.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Builder: &Builder{},
|
|
||||||
Template: testBuilderAccBlobLinux,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAccPreCheck(*testing.T) {}
|
func testAccPreCheck(*testing.T) {}
|
||||||
|
|
||||||
const testBuilderAccManagedDiskWindows = `
|
const testBuilderAccManagedDiskWindows = `
|
||||||
|
@ -106,7 +55,8 @@ const testBuilderAccManagedDiskWindows = `
|
||||||
"variables": {
|
"variables": {
|
||||||
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
||||||
|
"tenant_id": "{{env ` + "`ARM_TENANT_ID`" + `}}"
|
||||||
},
|
},
|
||||||
"builders": [{
|
"builders": [{
|
||||||
"type": "test",
|
"type": "test",
|
||||||
|
@ -114,6 +64,11 @@ const testBuilderAccManagedDiskWindows = `
|
||||||
"client_id": "{{user ` + "`client_id`" + `}}",
|
"client_id": "{{user ` + "`client_id`" + `}}",
|
||||||
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
"tenant_id": "{{user ` + "`tenant_id`" + `}}",
|
||||||
|
|
||||||
|
"lab_name": "packer-acceptance-test",
|
||||||
|
"lab_resource_group_name": "packer-acceptance-test",
|
||||||
|
"lab_virtual_network_name": "dtlpacker-acceptance-test",
|
||||||
|
|
||||||
"managed_image_resource_group_name": "packer-acceptance-test",
|
"managed_image_resource_group_name": "packer-acceptance-test",
|
||||||
"managed_image_name": "testBuilderAccManagedDiskWindows-{{timestamp}}",
|
"managed_image_name": "testBuilderAccManagedDiskWindows-{{timestamp}}",
|
||||||
|
@ -123,71 +78,6 @@ const testBuilderAccManagedDiskWindows = `
|
||||||
"image_offer": "WindowsServer",
|
"image_offer": "WindowsServer",
|
||||||
"image_sku": "2012-R2-Datacenter",
|
"image_sku": "2012-R2-Datacenter",
|
||||||
|
|
||||||
"communicator": "winrm",
|
|
||||||
"winrm_use_ssl": "true",
|
|
||||||
"winrm_insecure": "true",
|
|
||||||
"winrm_timeout": "3m",
|
|
||||||
"winrm_username": "packer",
|
|
||||||
"async_resourcegroup_delete": "true",
|
|
||||||
|
|
||||||
"location": "South Central US",
|
|
||||||
"vm_size": "Standard_DS2_v2"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const testBuilderAccManagedDiskWindowsBuildResourceGroup = `
|
|
||||||
{
|
|
||||||
"variables": {
|
|
||||||
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
|
||||||
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
|
||||||
},
|
|
||||||
"builders": [{
|
|
||||||
"type": "test",
|
|
||||||
|
|
||||||
"client_id": "{{user ` + "`client_id`" + `}}",
|
|
||||||
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
|
||||||
|
|
||||||
"build_resource_group_name" : "packer-acceptance-test",
|
|
||||||
"managed_image_resource_group_name": "packer-acceptance-test",
|
|
||||||
"managed_image_name": "testBuilderAccManagedDiskWindows-{{timestamp}}",
|
|
||||||
|
|
||||||
"os_type": "Windows",
|
|
||||||
"image_publisher": "MicrosoftWindowsServer",
|
|
||||||
"image_offer": "WindowsServer",
|
|
||||||
"image_sku": "2012-R2-Datacenter",
|
|
||||||
|
|
||||||
"communicator": "winrm",
|
|
||||||
"winrm_use_ssl": "true",
|
|
||||||
"winrm_insecure": "true",
|
|
||||||
"winrm_timeout": "3m",
|
|
||||||
"winrm_username": "packer",
|
|
||||||
"async_resourcegroup_delete": "true",
|
|
||||||
|
|
||||||
"vm_size": "Standard_DS2_v2"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const testBuilderAccManagedDiskWindowsDeviceLogin = `
|
|
||||||
{
|
|
||||||
"variables": {
|
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
|
||||||
},
|
|
||||||
"builders": [{
|
|
||||||
"type": "test",
|
|
||||||
|
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
|
||||||
|
|
||||||
"managed_image_resource_group_name": "packer-acceptance-test",
|
|
||||||
"managed_image_name": "testBuilderAccManagedDiskWindowsDeviceLogin-{{timestamp}}",
|
|
||||||
|
|
||||||
"os_type": "Windows",
|
|
||||||
"image_publisher": "MicrosoftWindowsServer",
|
|
||||||
"image_offer": "WindowsServer",
|
|
||||||
"image_sku": "2012-R2-Datacenter",
|
|
||||||
|
|
||||||
"communicator": "winrm",
|
"communicator": "winrm",
|
||||||
"winrm_use_ssl": "true",
|
"winrm_use_ssl": "true",
|
||||||
"winrm_insecure": "true",
|
"winrm_insecure": "true",
|
||||||
|
@ -205,7 +95,8 @@ const testBuilderAccManagedDiskLinux = `
|
||||||
"variables": {
|
"variables": {
|
||||||
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
||||||
|
"tenant_id": "{{env ` + "`ARM_TENANT_ID`" + `}}"
|
||||||
},
|
},
|
||||||
"builders": [{
|
"builders": [{
|
||||||
"type": "test",
|
"type": "test",
|
||||||
|
@ -214,6 +105,10 @@ const testBuilderAccManagedDiskLinux = `
|
||||||
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
|
||||||
|
"lab_name": "packer-acceptance-test",
|
||||||
|
"lab_resource_group_name": "packer-acceptance-test",
|
||||||
|
"lab_virtual_network_name": "dtlpacker-acceptance-test",
|
||||||
|
|
||||||
"managed_image_resource_group_name": "packer-acceptance-test",
|
"managed_image_resource_group_name": "packer-acceptance-test",
|
||||||
"managed_image_name": "testBuilderAccManagedDiskLinux-{{timestamp}}",
|
"managed_image_name": "testBuilderAccManagedDiskLinux-{{timestamp}}",
|
||||||
|
|
||||||
|
@ -223,101 +118,25 @@ const testBuilderAccManagedDiskLinux = `
|
||||||
"image_sku": "16.04-LTS",
|
"image_sku": "16.04-LTS",
|
||||||
|
|
||||||
"location": "South Central US",
|
"location": "South Central US",
|
||||||
"vm_size": "Standard_DS2_v2"
|
"vm_size": "Standard_DS2_v2",
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
"dtl_artifacts": [{
|
||||||
const testBuilderAccManagedDiskLinuxDeviceLogin = `
|
"artifact_name": "linux-apt-package",
|
||||||
{
|
"parameters" : [{
|
||||||
"variables": {
|
"name": "packages",
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
"value": "vim"
|
||||||
},
|
},
|
||||||
"builders": [{
|
{
|
||||||
"type": "test",
|
"name":"update",
|
||||||
|
"value": "true"
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
},
|
||||||
|
{
|
||||||
"managed_image_resource_group_name": "packer-acceptance-test",
|
"name": "options",
|
||||||
"managed_image_name": "testBuilderAccManagedDiskLinuxDeviceLogin-{{timestamp}}",
|
"value": "--fix-broken"
|
||||||
|
}]
|
||||||
"os_type": "Linux",
|
}]
|
||||||
"image_publisher": "Canonical",
|
|
||||||
"image_offer": "UbuntuServer",
|
|
||||||
"image_sku": "16.04-LTS",
|
|
||||||
"async_resourcegroup_delete": "true",
|
|
||||||
|
|
||||||
"location": "South Central US",
|
|
||||||
"vm_size": "Standard_DS2_v2"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const testBuilderAccBlobWindows = `
|
|
||||||
{
|
|
||||||
"variables": {
|
|
||||||
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
|
||||||
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
|
||||||
"object_id": "{{env ` + "`ARM_OBJECT_ID`" + `}}",
|
|
||||||
"storage_account": "{{env ` + "`ARM_STORAGE_ACCOUNT`" + `}}"
|
|
||||||
},
|
|
||||||
"builders": [{
|
|
||||||
"type": "test",
|
|
||||||
|
|
||||||
"client_id": "{{user ` + "`client_id`" + `}}",
|
|
||||||
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
|
||||||
"object_id": "{{user ` + "`object_id`" + `}}",
|
|
||||||
|
|
||||||
"storage_account": "{{user ` + "`storage_account`" + `}}",
|
|
||||||
"resource_group_name": "packer-acceptance-test",
|
|
||||||
"capture_container_name": "test",
|
|
||||||
"capture_name_prefix": "testBuilderAccBlobWin",
|
|
||||||
|
|
||||||
"os_type": "Windows",
|
|
||||||
"image_publisher": "MicrosoftWindowsServer",
|
|
||||||
"image_offer": "WindowsServer",
|
|
||||||
"image_sku": "2012-R2-Datacenter",
|
|
||||||
|
|
||||||
"communicator": "winrm",
|
|
||||||
"winrm_use_ssl": "true",
|
|
||||||
"winrm_insecure": "true",
|
|
||||||
"winrm_timeout": "3m",
|
|
||||||
"winrm_username": "packer",
|
|
||||||
|
|
||||||
"location": "South Central US",
|
|
||||||
"vm_size": "Standard_DS2_v2"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const testBuilderAccBlobLinux = `
|
|
||||||
{
|
|
||||||
"variables": {
|
|
||||||
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
|
||||||
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
|
||||||
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
|
||||||
"storage_account": "{{env ` + "`ARM_STORAGE_ACCOUNT`" + `}}"
|
|
||||||
},
|
|
||||||
"builders": [{
|
|
||||||
"type": "test",
|
|
||||||
|
|
||||||
"client_id": "{{user ` + "`client_id`" + `}}",
|
|
||||||
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
|
||||||
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
|
||||||
|
|
||||||
"storage_account": "{{user ` + "`storage_account`" + `}}",
|
|
||||||
"resource_group_name": "packer-acceptance-test",
|
|
||||||
"capture_container_name": "test",
|
|
||||||
"capture_name_prefix": "testBuilderAccBlobLinux",
|
|
||||||
|
|
||||||
"os_type": "Linux",
|
|
||||||
"image_publisher": "Canonical",
|
|
||||||
"image_offer": "UbuntuServer",
|
|
||||||
"image_sku": "16.04-LTS",
|
|
||||||
|
|
||||||
"location": "South Central US",
|
|
||||||
"vm_size": "Standard_DS2_v2"
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
|
@ -23,7 +23,6 @@ func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
|
||||||
constants.ArmResourceGroupName,
|
constants.ArmResourceGroupName,
|
||||||
constants.ArmVirtualMachineCaptureParameters,
|
constants.ArmVirtualMachineCaptureParameters,
|
||||||
constants.ArmPublicIPAddressName,
|
constants.ArmPublicIPAddressName,
|
||||||
constants.ArmAsyncResourceGroupDelete,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range expectedStateBagKeys {
|
for _, v := range expectedStateBagKeys {
|
||||||
|
|
|
@ -302,9 +302,6 @@ type Config struct {
|
||||||
|
|
||||||
Comm communicator.Config `mapstructure:",squash"`
|
Comm communicator.Config `mapstructure:",squash"`
|
||||||
ctx interpolate.Context
|
ctx interpolate.Context
|
||||||
|
|
||||||
//Cleanup
|
|
||||||
AsyncResourceGroupDelete bool `mapstructure:"async_resourcegroup_delete"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type keyVaultCertificate struct {
|
type keyVaultCertificate struct {
|
||||||
|
@ -693,10 +690,10 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.LabVirtualNetworkName == "" && c.LabResourceGroupName != "" {
|
if c.LabVirtualNetworkName == "" && c.LabResourceGroupName != "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If virtual_network_resource_group_name is specified, so must virtual_network_name"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If lab_resource_group_name is specified, so must lab_virtual_network_name"))
|
||||||
}
|
}
|
||||||
if c.LabVirtualNetworkName == "" && c.LabSubnetName != "" {
|
if c.LabVirtualNetworkName == "" && c.LabSubnetName != "" {
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If virtual_network_subnet_name is specified, so must virtual_network_name"))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If virtual_network_subnet_name is specified, so must lab_virtual_network_name"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
|
@ -125,7 +125,6 @@ type FlatConfig struct {
|
||||||
WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"`
|
WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"`
|
||||||
WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"`
|
WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"`
|
||||||
WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"`
|
WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"`
|
||||||
AsyncResourceGroupDelete *bool `mapstructure:"async_resourcegroup_delete" cty:"async_resourcegroup_delete"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatMapstructure returns a new FlatConfig.
|
// FlatMapstructure returns a new FlatConfig.
|
||||||
|
@ -229,7 +228,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
"winrm_use_ssl": &hcldec.AttrSpec{Name: "winrm_use_ssl", Type: cty.Bool, Required: false},
|
"winrm_use_ssl": &hcldec.AttrSpec{Name: "winrm_use_ssl", Type: cty.Bool, Required: false},
|
||||||
"winrm_insecure": &hcldec.AttrSpec{Name: "winrm_insecure", Type: cty.Bool, Required: false},
|
"winrm_insecure": &hcldec.AttrSpec{Name: "winrm_insecure", Type: cty.Bool, Required: false},
|
||||||
"winrm_use_ntlm": &hcldec.AttrSpec{Name: "winrm_use_ntlm", Type: cty.Bool, Required: false},
|
"winrm_use_ntlm": &hcldec.AttrSpec{Name: "winrm_use_ntlm", Type: cty.Bool, Required: false},
|
||||||
"async_resourcegroup_delete": &hcldec.AttrSpec{Name: "async_resourcegroup_delete", Type: cty.Bool, Required: false},
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,30 +424,6 @@ func TestConfigShouldAcceptDiskCachingTypes(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigShouldRejectTempAndBuildResourceGroupName(t *testing.T) {
|
|
||||||
config := map[string]interface{}{
|
|
||||||
"capture_name_prefix": "ignore",
|
|
||||||
"capture_container_name": "ignore",
|
|
||||||
"image_offer": "ignore",
|
|
||||||
"image_publisher": "ignore",
|
|
||||||
"image_sku": "ignore",
|
|
||||||
"location": "ignore",
|
|
||||||
"subscription_id": "ignore",
|
|
||||||
"communicator": "none",
|
|
||||||
"lab_resource_group_name": "ignore",
|
|
||||||
"lab_virtual_network_name": "ignore",
|
|
||||||
|
|
||||||
// custom may define one or the other, but not both
|
|
||||||
"temp_resource_group_name": "rgn00",
|
|
||||||
"build_resource_group_name": "rgn00",
|
|
||||||
}
|
|
||||||
|
|
||||||
_, _, err := newConfig(config, getPackerConfiguration())
|
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected config to reject the use of both temp_resource_group_name and build_resource_group_name")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestConfigAdditionalDiskDefaultIsNil(t *testing.T) {
|
func TestConfigAdditionalDiskDefaultIsNil(t *testing.T) {
|
||||||
c, _, _ := newConfig(getDtlBuilderConfiguration(), getPackerConfiguration())
|
c, _, _ := newConfig(getDtlBuilderConfiguration(), getPackerConfiguration())
|
||||||
if c.AdditionalDiskSize != nil {
|
if c.AdditionalDiskSize != nil {
|
||||||
|
@ -487,78 +463,6 @@ func TestConfigAdditionalDiskOverrideDefault(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigShouldAllowAsyncResourceGroupOverride(t *testing.T) {
|
|
||||||
config := map[string]interface{}{
|
|
||||||
"image_offer": "ignore",
|
|
||||||
"image_publisher": "ignore",
|
|
||||||
"image_sku": "ignore",
|
|
||||||
"location": "ignore",
|
|
||||||
"subscription_id": "ignore",
|
|
||||||
"communicator": "none",
|
|
||||||
"os_type": "linux",
|
|
||||||
"managed_image_name": "ignore",
|
|
||||||
"managed_image_resource_group_name": "ignore",
|
|
||||||
"async_resourcegroup_delete": "true",
|
|
||||||
"lab_resource_group_name": "ignore",
|
|
||||||
"lab_virtual_network_name": "ignore",
|
|
||||||
}
|
|
||||||
|
|
||||||
c, _, err := newConfig(config, getPackerConfiguration())
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("newConfig failed with %q", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.AsyncResourceGroupDelete != true {
|
|
||||||
t.Errorf("expected async_resourcegroup_delete to be %q, but got %t", "async_resourcegroup_delete", c.AsyncResourceGroupDelete)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func TestConfigShouldAllowAsyncResourceGroupOverrideNoValue(t *testing.T) {
|
|
||||||
config := map[string]interface{}{
|
|
||||||
"image_offer": "ignore",
|
|
||||||
"image_publisher": "ignore",
|
|
||||||
"image_sku": "ignore",
|
|
||||||
"location": "ignore",
|
|
||||||
"subscription_id": "ignore",
|
|
||||||
"communicator": "none",
|
|
||||||
"os_type": "linux",
|
|
||||||
"managed_image_name": "ignore",
|
|
||||||
"managed_image_resource_group_name": "ignore",
|
|
||||||
"lab_resource_group_name": "ignore",
|
|
||||||
"lab_virtual_network_name": "ignore",
|
|
||||||
}
|
|
||||||
|
|
||||||
c, _, err := newConfig(config, getPackerConfiguration())
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("newConfig failed with %q", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.AsyncResourceGroupDelete != false {
|
|
||||||
t.Errorf("expected async_resourcegroup_delete to be %q, but got %t", "async_resourcegroup_delete", c.AsyncResourceGroupDelete)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func TestConfigShouldAllowAsyncResourceGroupOverrideBadValue(t *testing.T) {
|
|
||||||
config := map[string]interface{}{
|
|
||||||
"image_offer": "ignore",
|
|
||||||
"image_publisher": "ignore",
|
|
||||||
"image_sku": "ignore",
|
|
||||||
"location": "ignore",
|
|
||||||
"subscription_id": "ignore",
|
|
||||||
"communicator": "none",
|
|
||||||
"os_type": "linux",
|
|
||||||
"managed_image_name": "ignore",
|
|
||||||
"managed_image_resource_group_name": "ignore",
|
|
||||||
"async_resourcegroup_delete": "asdasda",
|
|
||||||
"lab_resource_group_name": "ignore",
|
|
||||||
"lab_virtual_network_name": "ignore",
|
|
||||||
}
|
|
||||||
|
|
||||||
c, _, err := newConfig(config, getPackerConfiguration())
|
|
||||||
if err != nil && c == nil {
|
|
||||||
t.Log("newConfig failed which is expected ", err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
func TestConfigShouldAllowSharedImageGalleryOptions(t *testing.T) {
|
func TestConfigShouldAllowSharedImageGalleryOptions(t *testing.T) {
|
||||||
config := map[string]interface{}{
|
config := map[string]interface{}{
|
||||||
"location": "ignore",
|
"location": "ignore",
|
||||||
|
@ -594,8 +498,6 @@ func TestConfigShouldRejectSharedImageGalleryWithVhdTarget(t *testing.T) {
|
||||||
"image_name": "ignore",
|
"image_name": "ignore",
|
||||||
"image_version": "ignore",
|
"image_version": "ignore",
|
||||||
},
|
},
|
||||||
"resource_group_name": "ignore",
|
|
||||||
"storage_account": "ignore",
|
|
||||||
"capture_container_name": "ignore",
|
"capture_container_name": "ignore",
|
||||||
"capture_name_prefix": "ignore",
|
"capture_name_prefix": "ignore",
|
||||||
"lab_resource_group_name": "ignore",
|
"lab_resource_group_name": "ignore",
|
||||||
|
|
|
@ -1,102 +0,0 @@
|
||||||
(2020-01-03T11:14:50.7650470-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081?api-version=2016-06-01
|
|
||||||
User-Agent: Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 subscriptions/2016-06-01
|
|
||||||
(2020-01-03T11:14:51.1254910-08:00) INFO: RESPONSE: 401 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081?api-version=2016-06-01
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191448Z:cfef32b3-e72f-4b06-849e-aedf98a3baf0
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:48 GMT
|
|
||||||
Cache-Control: no-cache
|
|
||||||
Expires: -1
|
|
||||||
Content-Length: 115
|
|
||||||
X-Ms-Request-Id: cfef32b3-e72f-4b06-849e-aedf98a3baf0
|
|
||||||
X-Ms-Correlation-Request-Id: cfef32b3-e72f-4b06-849e-aedf98a3baf0
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
Pragma: no-cache
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
Www-Authenticate: Bearer authorization_uri="https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", error="invalid_token", error_description="The authentication failed because of missing 'Authorization' header."
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
{"error":{"code":"AuthenticationFailed","message":"Authentication failed. The 'Authorization' header is missing."}}
|
|
||||||
(2020-01-03T11:14:51.3698460-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups/packer-acceptance-test/providers/Microsoft.DevTestLab/labs//customimages/testBuilderAccManagedDiskWindows-1578078890?api-version=2018-09-15
|
|
||||||
User-Agent: Packer/1.5.0-dev (+https://www.packer.io/; go1.13.1; darwin/amd64) Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 dtl/2018-09-15
|
|
||||||
Authorization: **REDACTED**
|
|
||||||
(2020-01-03T11:14:51.5297600-08:00) INFO: RESPONSE: 404 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups/packer-acceptance-test/providers/Microsoft.DevTestLab/labs//customimages/testBuilderAccManagedDiskWindows-1578078890?api-version=2018-09-15
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
X-Ms-Request-Id: 0464a3f7-cf7e-456e-bffc-451f4fa1e12d
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
Content-Length: 114
|
|
||||||
Pragma: no-cache
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
Expires: -1
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:48 GMT
|
|
||||||
Cache-Control: no-cache
|
|
||||||
X-Ms-Correlation-Request-Id: 0464a3f7-cf7e-456e-bffc-451f4fa1e12d
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191449Z:0464a3f7-cf7e-456e-bffc-451f4fa1e12d
|
|
||||||
{"error":{"code":"ResourceGroupNotFound","message":"Resource group 'packer-acceptance-test' could not be found."}}
|
|
||||||
(2020-01-03T11:14:51.5392840-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups//providers/Microsoft.DevTestLab/labs/?api-version=2018-09-15
|
|
||||||
Authorization: **REDACTED**
|
|
||||||
User-Agent: Packer/1.5.0-dev (+https://www.packer.io/; go1.13.1; darwin/amd64) Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 dtl/2018-09-15
|
|
||||||
(2020-01-03T11:14:51.5804680-08:00) INFO: RESPONSE: 400 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups//providers/Microsoft.DevTestLab/labs/?api-version=2018-09-15
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:48 GMT
|
|
||||||
Cache-Control: no-cache
|
|
||||||
Pragma: no-cache
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
X-Ms-Request-Id: 8b3aeb52-7eea-47d6-b0a1-f58aa0e3bed6
|
|
||||||
Expires: -1
|
|
||||||
X-Ms-Correlation-Request-Id: 8b3aeb52-7eea-47d6-b0a1-f58aa0e3bed6
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191449Z:8b3aeb52-7eea-47d6-b0a1-f58aa0e3bed6
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
Content-Length: 520
|
|
||||||
{"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2018-09-15' is invalid. The supported versions are '2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}
|
|
||||||
(2020-01-03T11:14:52.5925920-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081?api-version=2016-06-01
|
|
||||||
User-Agent: Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 subscriptions/2016-06-01
|
|
||||||
(2020-01-03T11:14:52.7012490-08:00) INFO: RESPONSE: 401 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081?api-version=2016-06-01
|
|
||||||
Www-Authenticate: Bearer authorization_uri="https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", error="invalid_token", error_description="The authentication failed because of missing 'Authorization' header."
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
Content-Length: 115
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
X-Ms-Request-Id: a970f18e-ca06-42ee-b2d0-541640aeaf3f
|
|
||||||
X-Ms-Correlation-Request-Id: a970f18e-ca06-42ee-b2d0-541640aeaf3f
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191450Z:a970f18e-ca06-42ee-b2d0-541640aeaf3f
|
|
||||||
Expires: -1
|
|
||||||
Cache-Control: no-cache
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:49 GMT
|
|
||||||
Pragma: no-cache
|
|
||||||
{"error":{"code":"AuthenticationFailed","message":"Authentication failed. The 'Authorization' header is missing."}}
|
|
||||||
(2020-01-03T11:14:53.1100660-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups/packer-acceptance-test/providers/Microsoft.DevTestLab/labs//customimages/testBuilderAccManagedDiskLinux-1578078890?api-version=2018-09-15
|
|
||||||
User-Agent: Packer/1.5.0-dev (+https://www.packer.io/; go1.13.1; darwin/amd64) Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 dtl/2018-09-15
|
|
||||||
Authorization: **REDACTED**
|
|
||||||
(2020-01-03T11:14:53.2497970-08:00) INFO: RESPONSE: 404 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups/packer-acceptance-test/providers/Microsoft.DevTestLab/labs//customimages/testBuilderAccManagedDiskLinux-1578078890?api-version=2018-09-15
|
|
||||||
X-Ms-Request-Id: d9969a0a-be31-424a-b4ad-5006a44590d0
|
|
||||||
X-Ms-Correlation-Request-Id: d9969a0a-be31-424a-b4ad-5006a44590d0
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191450Z:d9969a0a-be31-424a-b4ad-5006a44590d0
|
|
||||||
Cache-Control: no-cache
|
|
||||||
Pragma: no-cache
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:50 GMT
|
|
||||||
Content-Length: 114
|
|
||||||
Expires: -1
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
{"error":{"code":"ResourceGroupNotFound","message":"Resource group 'packer-acceptance-test' could not be found."}}
|
|
||||||
(2020-01-03T11:14:53.2628590-08:00) INFO: REQUEST: GET https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups//providers/Microsoft.DevTestLab/labs/?api-version=2018-09-15
|
|
||||||
User-Agent: Packer/1.5.0-dev (+https://www.packer.io/; go1.13.1; darwin/amd64) Go/go1.13.1 (amd64-darwin) go-autorest/v12.0.0 Azure-SDK-For-Go/v30.0.0 dtl/2018-09-15
|
|
||||||
Authorization: **REDACTED**
|
|
||||||
(2020-01-03T11:14:53.3067870-08:00) INFO: RESPONSE: 400 https://management.azure.com/subscriptions/cba4e087-aceb-44f0-970e-65e96eff4081/resourceGroups//providers/Microsoft.DevTestLab/labs/?api-version=2018-09-15
|
|
||||||
Pragma: no-cache
|
|
||||||
Content-Type: application/json; charset=utf-8
|
|
||||||
Expires: -1
|
|
||||||
X-Content-Type-Options: nosniff
|
|
||||||
Content-Length: 520
|
|
||||||
Cache-Control: no-cache
|
|
||||||
X-Ms-Failure-Cause: gateway
|
|
||||||
X-Ms-Request-Id: de1644d3-f44e-4639-95ba-f1aeb8f4032d
|
|
||||||
X-Ms-Correlation-Request-Id: de1644d3-f44e-4639-95ba-f1aeb8f4032d
|
|
||||||
X-Ms-Routing-Request-Id: WESTUS:20200103T191450Z:de1644d3-f44e-4639-95ba-f1aeb8f4032d
|
|
||||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
||||||
Date: Fri, 03 Jan 2020 19:14:50 GMT
|
|
||||||
{"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2018-09-15' is invalid. The supported versions are '2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}
|
|
|
@ -75,7 +75,7 @@ func (s *StepCaptureImage) captureImageFromVM(ctx context.Context) error {
|
||||||
CustomImageProperties: &customImageProperties,
|
CustomImageProperties: &customImageProperties,
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := s.client.DtlCustomImageClient.CreateOrUpdate(ctx, s.config.tmpResourceGroupName, s.config.LabName, s.config.ManagedImageName, *customImage)
|
f, err := s.client.DtlCustomImageClient.CreateOrUpdate(ctx, s.config.LabResourceGroupName, s.config.LabName, s.config.ManagedImageName, *customImage)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = f.WaitForCompletionRef(ctx, s.client.DtlCustomImageClient.Client)
|
err = f.WaitForCompletionRef(ctx, s.client.DtlCustomImageClient.Client)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (s *StepPowerOffCompute) Run(ctx context.Context, state multistep.StateBag)
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
||||||
|
|
||||||
err := s.powerOff(ctx, resourceGroupName, s.config.LabName, computeName)
|
err := s.powerOff(ctx, s.config.LabResourceGroupName, s.config.LabName, computeName)
|
||||||
|
|
||||||
s.say("Powering off machine ...Complete")
|
s.say("Powering off machine ...Complete")
|
||||||
return processStepResult(err, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
|
|
|
@ -81,7 +81,7 @@ func GetVirtualMachineDeployment(config *Config) (*dtl.LabVirtualMachineCreation
|
||||||
if strings.ToLower(config.OSType) == "windows" {
|
if strings.ToLower(config.OSType) == "windows" {
|
||||||
// Add mandatory Artifact
|
// Add mandatory Artifact
|
||||||
var winrma = "windows-winrm"
|
var winrma = "windows-winrm"
|
||||||
var artifactid = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/artifactSources/privaterepo457/artifacts/%s",
|
var artifactid = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/artifactSources/public repo/artifacts/%s",
|
||||||
config.ClientConfig.SubscriptionID,
|
config.ClientConfig.SubscriptionID,
|
||||||
config.tmpResourceGroupName,
|
config.tmpResourceGroupName,
|
||||||
config.LabName,
|
config.LabName,
|
||||||
|
|
|
@ -40,7 +40,7 @@ type Config struct {
|
||||||
DtlArtifacts []DtlArtifact `mapstructure:"dtl_artifacts"`
|
DtlArtifacts []DtlArtifact `mapstructure:"dtl_artifacts"`
|
||||||
LabName string `mapstructure:"lab_name"`
|
LabName string `mapstructure:"lab_name"`
|
||||||
|
|
||||||
ResourceGroupName string `mapstructure:"resource_group_name"`
|
ResourceGroupName string `mapstructure:"lab_resource_group_name"`
|
||||||
|
|
||||||
VMName string `mapstructure:"vm_name"`
|
VMName string `mapstructure:"vm_name"`
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ type FlatConfig struct {
|
||||||
SubscriptionID *string `mapstructure:"subscription_id" cty:"subscription_id"`
|
SubscriptionID *string `mapstructure:"subscription_id" cty:"subscription_id"`
|
||||||
DtlArtifacts []FlatDtlArtifact `mapstructure:"dtl_artifacts" cty:"dtl_artifacts"`
|
DtlArtifacts []FlatDtlArtifact `mapstructure:"dtl_artifacts" cty:"dtl_artifacts"`
|
||||||
LabName *string `mapstructure:"lab_name" cty:"lab_name"`
|
LabName *string `mapstructure:"lab_name" cty:"lab_name"`
|
||||||
ResourceGroupName *string `mapstructure:"resource_group_name" cty:"resource_group_name"`
|
ResourceGroupName *string `mapstructure:"lab_resource_group_name" cty:"lab_resource_group_name"`
|
||||||
VMName *string `mapstructure:"vm_name" cty:"vm_name"`
|
VMName *string `mapstructure:"vm_name" cty:"vm_name"`
|
||||||
PollingDurationTimeout *string `mapstructure:"polling_duration_timeout" required:"false" cty:"polling_duration_timeout"`
|
PollingDurationTimeout *string `mapstructure:"polling_duration_timeout" required:"false" cty:"polling_duration_timeout"`
|
||||||
AzureTags map[string]*string `mapstructure:"azure_tags" cty:"azure_tags"`
|
AzureTags map[string]*string `mapstructure:"azure_tags" cty:"azure_tags"`
|
||||||
|
@ -89,7 +89,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
"subscription_id": &hcldec.AttrSpec{Name: "subscription_id", Type: cty.String, Required: false},
|
"subscription_id": &hcldec.AttrSpec{Name: "subscription_id", Type: cty.String, Required: false},
|
||||||
"dtl_artifacts": &hcldec.BlockListSpec{TypeName: "dtl_artifacts", Nested: hcldec.ObjectSpec((*FlatDtlArtifact)(nil).HCL2Spec())},
|
"dtl_artifacts": &hcldec.BlockListSpec{TypeName: "dtl_artifacts", Nested: hcldec.ObjectSpec((*FlatDtlArtifact)(nil).HCL2Spec())},
|
||||||
"lab_name": &hcldec.AttrSpec{Name: "lab_name", Type: cty.String, Required: false},
|
"lab_name": &hcldec.AttrSpec{Name: "lab_name", Type: cty.String, Required: false},
|
||||||
"resource_group_name": &hcldec.AttrSpec{Name: "resource_group_name", Type: cty.String, Required: false},
|
"lab_resource_group_name": &hcldec.AttrSpec{Name: "lab_resource_group_name", Type: cty.String, Required: false},
|
||||||
"vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false},
|
"vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false},
|
||||||
"polling_duration_timeout": &hcldec.AttrSpec{Name: "polling_duration_timeout", Type: cty.String, Required: false},
|
"polling_duration_timeout": &hcldec.AttrSpec{Name: "polling_duration_timeout", Type: cty.String, Required: false},
|
||||||
"azure_tags": &hcldec.BlockAttrsSpec{TypeName: "azure_tags", ElementType: cty.String, Required: false},
|
"azure_tags": &hcldec.BlockAttrsSpec{TypeName: "azure_tags", ElementType: cty.String, Required: false},
|
||||||
|
|
|
@ -184,5 +184,3 @@
|
||||||
|
|
||||||
- `vm_name` (string) - Name of the temporary virtual machine that can be optionally specified.
|
- `vm_name` (string) - Name of the temporary virtual machine that can be optionally specified.
|
||||||
|
|
||||||
- `async_resourcegroup_delete` (bool) - Cleanup
|
|
||||||
|
|
Loading…
Reference in New Issue