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 fa04387550)
pull/45581/head
Yuwei Zhou 6 years ago committed by Toshio Kuratomi
parent 9a0f1d8915
commit e16d36f0f7

@ -0,0 +1,3 @@
---
bugfixes:
- fix azure_rm_autoscale module can use dict to identify target (https://github.com/ansible/ansible/pull/45477)

@ -521,11 +521,11 @@ class AzureRMAutoScale(AzureRMModuleBase):
resource_id = self.target resource_id = self.target
if isinstance(self.target, dict): if isinstance(self.target, dict):
resource_id = format_resource_id(val=self.target.name, resource_id = format_resource_id(val=self.target['name'],
subscription_id=self.target.subscription_id or self.subscription_id, subscription_id=self.target.get('subscription_id') or self.subscription_id,
namespace=self.target.namespace, namespace=self.target['namespace'],
types=self.target.types, types=self.target['types'],
resource_group=self.target.resource_group or self.resource_group) resource_group=self.target.get('resource_group') or self.resource_group)
self.target = resource_id self.target = resource_id
resource_name = self.name resource_name = self.name

@ -74,7 +74,10 @@
azure_rm_autoscale: azure_rm_autoscale:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "{{ name }}" name: "{{ name }}"
target: "{{ vmss.ansible_facts.azure_vmss.id }}" target:
name: "testVMSS{{ rpfx }}"
types: "virtualMachineScaleSets"
namespace: "Microsoft.Compute"
enabled: true enabled: true
profiles: profiles:
- count: '1' - count: '1'

Loading…
Cancel
Save