Commit Graph

515 Commits

Author SHA1 Message Date
Wilken Rivera a1d69bfe91 Fix liniting issues 2020-10-23 13:52:05 -04:00
Wilken Rivera afd33679f5 builder/azure_arm: Fix build failures due to the deletion of attached managed disks
Previously (prior to v1.6.2) the Azure ARM builder had two delete functions
one that would run before any of the StepDelete* types, and one on deployment template
cleanup. The refactored coded re-introduces the logic from the previously removed
step in v1.6.1 as the main delete logic for the whole deployment
template. Ensuring that all deployed items are deleted before trying to
remove any managed disks.

This change moves all the deletion logic into the
step_deployment_template#Cleanup function to ensure that dependent steps
are only called once the created deployment items (i.e
StepDelateAdditionalDisks) have been deleted.

Test results before change
```

    compute.DisksClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Disk pkrdd02e9rzzu5k-1 is attached to VM /subscriptions/1f90521a-24f6-4758-ac3d-88d869fb0bf5/resourceGroups/packer-acceptance-test/providers/Microsoft.Compute/virtualMachines/pkrvm02e9rzzu5k."
--- FAIL: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group_Additional_Disk (454.00s)
FAIL
FAIL    github.com/hashicorp/packer/builder/azure/arm   454.008s

```

Test results after change
```
--- PASS: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group_Additional_Disk (563.56s)

```

Closes #10070
2020-10-23 13:44:27 -04:00
Megan Marsh 70cb4097e1 review comments, add plugin type for a few missing builders 2020-10-21 16:17:32 -07:00
Megan Marsh c0ce8a9414 rework fixer deprecation code so we know what plugins they relate to 2020-10-21 15:28:59 -07:00
Wilken Rivera a2ba700ac0 Remove deprecated object ids from configs 2020-10-21 13:56:22 -04:00
Wilken Rivera 1621ab59d8
tests/azure/arm: Update test image name (#10133)
I've run into a few cases where running the full test suite for the ARM
builder would fail because of conflicting image names. This is a
workaround for now the bigger fix is to have the acceptance clean up any
created images.

Results before change
```
the managed image named testBuilderAccManagedDiskWindows-1603151855 already exists in the resource group packer-acceptance-test, use the -force option to automatically delete it.
--- FAIL: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group (0.66s)
```

Results after change
```
PASS
ok      github.com/hashicorp/packer/builder/azure/arm   2431.115s

```
2020-10-21 11:12:50 +02:00
Wilken Rivera c7ba5c9a14
Fix line ending issues for test files (#10096) 2020-10-14 11:03:43 +02:00
Megan Marsh d6aa172edc remove typo'd option from docs 2020-10-07 16:14:13 -07:00
Ricardo Rosales 809f38be3a
[azure-chroot] Updating parameter `exlude_from_latest` to `exclude_from_latest` (#10034) 2020-10-07 11:08:33 +02:00
Braunson b2047bd938
Put the correct AzureTags type in StateBag (#10014)
Azure expects the tags format to use a pointer to the string for the map value.
The configuration from the builder is not a pointer so when storing in the state bag for
reference in later execution we convert it when creating the StateBag.

Fixes #10012 and #10013.

* Use the MapToAzureTags helper and error check in resource group creation

* Added test case for tag values not using a pointer

* test/azure/arm: Add test to verify tags stored in state

* test/azure/arm: Add azure_tags to existing acceptance test for Linux

Test Before Fix
```
--- FAIL: TestBuilderAcc_ManagedDisk_Linux (1.81s)
panic: interface conversion: interface {} is map[string]string, not map[string]*string [recovered]
        panic: interface conversion: interface {} is map[string]string, not map[string]*string
FAIL    github.com/hashicorp/packer/builder/azure/arm   1.822s

```

Test After Fix
```
2020/09/29 17:23:03 ui: ==> test: Resource group has been deleted.
--- PASS: TestBuilderAcc_ManagedDisk_Linux (517.41s)
    PASS
    ok      github.com/hashicorp/packer/builder/azure/arm   517.426s
```

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2020-09-30 09:55:46 -04:00
Adrien Delorme 654fade0a9
azure arm: make map[string]*string => map[string]string to simplify things (#9985)
* azure arm: make map[string]*string => map[string]string to simplify things
* go generate ./builder/azure/...
* tests !

fix #9984
2020-09-24 12:19:26 +02:00
Sylvia Moss ba74602d63
Allows publishing to a Shared Image Gallery with a different subscription id (#9875) 2020-09-03 17:13:32 +02:00
Megan Marsh e97c56dc72
Merge pull request #9559 from hashicorp/fix_9482
builder/azure-arm: Remove duplicate resource deletion steps
2020-08-12 12:43:09 -07:00
Wilken Rivera 55812fe8a5 Handle error of deferred deletion 2020-08-12 11:30:15 -04:00
Wilken Rivera 5700f74c8c Handle lease not present error 2020-08-12 11:27:07 -04:00
Wilken Rivera d91839b93e Update deletion logic for OS disks
* Add an ResourceNotFound error check
* Add logic to break temporary disk lease before deleting it
2020-08-12 11:03:51 -04:00
Wilken Rivera ba6d11d518 Remove StepDeleteOSDisk in favor of StepDeployTemplate#Cleanup 2020-08-12 11:03:03 -04:00
Wilken Rivera aed97e1a8b Ensure any active leases are brokend before deleting 2020-08-11 16:41:28 -04:00
Wilken Rivera 920da9d0a4 Fix up code to remove some additional steps 2020-08-11 16:40:51 -04:00
Megan Marsh f8bb9008c0
Merge pull request #9697 from backerman/personal/backerman/9695
Add FreeBSD support to azure/chroot
2020-08-10 12:47:48 -07:00
Wilken Rivera 7c28d5590c Remove StepDeleteResourceGroup in favor of StepDeploymentTemplate#Cleanup 2020-08-10 12:57:11 -04:00
Brad Ackerman 23d5432333
Revert inadvertently-changed import. 2020-08-09 14:31:54 -07:00
Brad Ackerman 109b2a0ca9
Build constraints don't seem to work on test. 2020-08-09 14:12:58 -07:00
Brad Ackerman 94c9b87431
Only run on platforms supported by chroot. 2020-08-09 13:53:21 -07:00
Brad Ackerman 33eb8483ba
Get some tests in here. 2020-08-09 13:39:29 -07:00
Megan Marsh 4964c54f60 update docs to state resource id must be fully qualified 2020-08-06 10:41:18 -07:00
Megan Marsh aede34079d provide more helpful error message than the one returned by the client, without context 2020-08-05 09:52:11 -07:00
Brad Ackerman fb1a4bd86f
Add placeholder diskattacher for other OSes. 2020-08-01 21:59:43 -07:00
Brad Ackerman 5ce6c8564c
Fix ordering to match master for better diffs. 2020-08-01 21:30:44 -07:00
Brad Ackerman 13a4e47efe
Increase wait time for device to be created. 2020-08-01 21:22:50 -07:00
Brad Ackerman 364c415294
Add FreeBSD support. 2020-08-01 21:22:50 -07:00
Megan Marsh a687d6fe12
ci/tech-debt: Fix vmware acceptance tests (#9636)
* add kex algorithm option to ssh config

* regenerate code

* This commit fixes old vmware acceptance tests that have not been run in some time. It does this in two parts:
1) It modifies the minimal vmware build configuration to use a custom kex algorithm, which enables the ssh connection to succeed.
2) It modifies logic in reading and defaulting hardware config values, which was crashing.
3) It adds a new acceptance test with a preseed file to test loading from an http directory.
2020-07-23 09:40:57 +02:00
Megan Marsh 8964367eb5
Merge pull request #9603 from paulmey/disable-password
[azure-arm] Disable ssh password authentication unless password is explicitly specified
2020-07-17 09:32:38 -07:00
Paul Meyer 708ca1c126 Add some error checking 2020-07-16 23:22:24 +00:00
Paul Meyer deca28c158 Disable password auth on ssh key Linux builds 2020-07-16 22:26:06 +00:00
Paul Meyer 5fd68374fe Optionally disable password authentication for Linux builds 2020-07-16 19:44:01 +00:00
Roger Hu 28f8241a05 update generated files 2020-07-10 16:58:06 -07:00
Megan Marsh d4a7dd24d9
fix link in deprecation warning (#9544) 2020-07-08 11:59:39 +02:00
Moss 8ea64c5b35 undocument ssh_keypair_name and ssh_agent_auth 2020-07-02 14:55:58 +02:00
Moss 41edd09d3c undocument temporary_key_pair_name and ssh_private_key_file 2020-07-01 16:33:18 +02:00
Wilken Rivera 8d209caf34 Fix spacing and line endings 2020-06-24 09:20:32 -04:00
Arsenii Petrovich f3c33f9a27 remove spaces 2020-06-24 16:08:48 +03:00
Arsenii Petrovich c2f352ee6e Update JSONs to fix tests and make them work with the latest URL changes 2020-06-24 01:35:35 +03:00
Arsenii Petrovich d7b8d50acd
Fix data disks URI
Fixing bug appeared in 0589f57d4d
2020-06-23 12:58:53 +03:00
Megan Marsh 4f77bb0c4a add new ssh_ciphers option 2020-06-17 16:48:23 -07:00
Megan Marsh 4178625afb re-add winrm_no_proxy option. Winrm code needs to be modified in order to read no_proxy env var when client is created rather than when net/http library is instantiated. 2020-06-16 10:27:30 -07:00
Megan Marsh 02590f6c44
Merge pull request #9329 from hashicorp/je.website-maintenance-5-29-20
🌷 Website Spring Maintenance
2020-06-03 16:25:23 -07:00
Paul Meyer e260212be3
Merge pull request #9323 [azure-chroot] copy data disks between shared image galleries
[azure-chroot] copy data disks between shared image galleries
2020-06-03 12:32:19 -07:00
Jeff Escalante 9a38fbe2c7
patch source for a couple code block changes 2020-05-29 17:22:16 -04:00
Paul Meyer 2288ab3b53 fix typo 2020-05-29 04:15:53 +00:00