diff options
author | Yuwei Zhou <yuwzho@microsoft.com> | 2018-09-13 03:46:16 +0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2018-09-12 12:46:16 -0700 |
commit | e16d36f0f70a61abc71c0aeb7b4c8be359263144 (patch) | |
tree | faf0682d26313b384fc8105d4a688ec2edba6d49 | |
parent | 9a0f1d89159f916fe71a13abe63840661cbd1c14 (diff) | |
download | ansible-e16d36f0f70a61abc71c0aeb7b4c8be359263144.tar.gz |
Backport: fix the autoscale resource id #45477 (#45532)
* fix the autoscale resource id (#45477)
* fix the autoscale resource id
* Update main.yml
(cherry picked from commit fa04387550de60921373f9d225745d7ca1f80712)
-rw-r--r-- | changelogs/fragments/azure_autoscale.yaml | 3 | ||||
-rw-r--r-- | lib/ansible/modules/cloud/azure/azure_rm_autoscale.py | 10 | ||||
-rw-r--r-- | test/integration/targets/azure_rm_autoscale/tasks/main.yml | 5 |
3 files changed, 12 insertions, 6 deletions
diff --git a/changelogs/fragments/azure_autoscale.yaml b/changelogs/fragments/azure_autoscale.yaml new file mode 100644 index 0000000000..92c4ea579c --- /dev/null +++ b/changelogs/fragments/azure_autoscale.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- fix azure_rm_autoscale module can use dict to identify target (https://github.com/ansible/ansible/pull/45477) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_autoscale.py b/lib/ansible/modules/cloud/azure/azure_rm_autoscale.py index 5db8e51685..dacc56d525 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_autoscale.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_autoscale.py @@ -521,11 +521,11 @@ class AzureRMAutoScale(AzureRMModuleBase): resource_id = self.target if isinstance(self.target, dict): - resource_id = format_resource_id(val=self.target.name, - subscription_id=self.target.subscription_id or self.subscription_id, - namespace=self.target.namespace, - types=self.target.types, - resource_group=self.target.resource_group or self.resource_group) + resource_id = format_resource_id(val=self.target['name'], + subscription_id=self.target.get('subscription_id') or self.subscription_id, + namespace=self.target['namespace'], + types=self.target['types'], + resource_group=self.target.get('resource_group') or self.resource_group) self.target = resource_id resource_name = self.name diff --git a/test/integration/targets/azure_rm_autoscale/tasks/main.yml b/test/integration/targets/azure_rm_autoscale/tasks/main.yml index ab90d92030..af769c99bd 100644 --- a/test/integration/targets/azure_rm_autoscale/tasks/main.yml +++ b/test/integration/targets/azure_rm_autoscale/tasks/main.yml @@ -74,7 +74,10 @@ azure_rm_autoscale: resource_group: "{{ resource_group }}" name: "{{ name }}" - target: "{{ vmss.ansible_facts.azure_vmss.id }}" + target: + name: "testVMSS{{ rpfx }}" + types: "virtualMachineScaleSets" + namespace: "Microsoft.Compute" enabled: true profiles: - count: '1' |