fixing resource facts (#53727)
This commit is contained in:
parent
c2466c545b
commit
a202509ba4
3 changed files with 24 additions and 5 deletions
|
@ -127,7 +127,7 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
|||
)
|
||||
# store the results of the module operation
|
||||
self.results = dict(
|
||||
response=None
|
||||
response=[]
|
||||
)
|
||||
self.mgmt_client = None
|
||||
self.url = None
|
||||
|
@ -189,7 +189,6 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
|||
if skiptoken:
|
||||
query_parameters['skiptoken'] = skiptoken
|
||||
response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0)
|
||||
|
||||
try:
|
||||
response = json.loads(response.text)
|
||||
if isinstance(response, dict):
|
||||
|
@ -198,8 +197,8 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
|||
skiptoken = response.get('nextLink')
|
||||
else:
|
||||
self.results['response'] = self.results['response'] + [response]
|
||||
except Exception:
|
||||
self.results['response'] = []
|
||||
except Exception as e:
|
||||
self.fail('Failed to parse response: ' + str(e))
|
||||
if not skiptoken:
|
||||
break
|
||||
return self.results
|
||||
|
|
|
@ -3,4 +3,3 @@ destructive
|
|||
shippable/azure/group2
|
||||
azure_rm_keyvaultkey
|
||||
azure_rm_keyvaultsecret
|
||||
disabled
|
||||
|
|
|
@ -65,6 +65,27 @@
|
|||
resource_name: "{{ nsgname }}"
|
||||
register: output
|
||||
|
||||
- name: Assert value was returned
|
||||
assert:
|
||||
that:
|
||||
- not output.changed
|
||||
- output.response[0]['name'] != None
|
||||
- output.response | length == 1
|
||||
|
||||
- name: Try to query a list
|
||||
azure_rm_resource_facts:
|
||||
api_version: '2018-02-01'
|
||||
resource_group: "{{ resource_group }}"
|
||||
provider: network
|
||||
resource_type: networksecuritygroups
|
||||
register: output
|
||||
- name: Assert value was returned
|
||||
assert:
|
||||
that:
|
||||
- not output.changed
|
||||
- output.response[0]['name'] != None
|
||||
- output.response | length >= 1
|
||||
|
||||
- name: Create storage account that requires LRO polling
|
||||
azure_rm_resource:
|
||||
polling_timeout: 600
|
||||
|
|
Loading…
Reference in a new issue