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
|
# store the results of the module operation
|
||||||
self.results = dict(
|
self.results = dict(
|
||||||
response=None
|
response=[]
|
||||||
)
|
)
|
||||||
self.mgmt_client = None
|
self.mgmt_client = None
|
||||||
self.url = None
|
self.url = None
|
||||||
|
@ -189,7 +189,6 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
||||||
if skiptoken:
|
if skiptoken:
|
||||||
query_parameters['skiptoken'] = skiptoken
|
query_parameters['skiptoken'] = skiptoken
|
||||||
response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0)
|
response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = json.loads(response.text)
|
response = json.loads(response.text)
|
||||||
if isinstance(response, dict):
|
if isinstance(response, dict):
|
||||||
|
@ -198,8 +197,8 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
||||||
skiptoken = response.get('nextLink')
|
skiptoken = response.get('nextLink')
|
||||||
else:
|
else:
|
||||||
self.results['response'] = self.results['response'] + [response]
|
self.results['response'] = self.results['response'] + [response]
|
||||||
except Exception:
|
except Exception as e:
|
||||||
self.results['response'] = []
|
self.fail('Failed to parse response: ' + str(e))
|
||||||
if not skiptoken:
|
if not skiptoken:
|
||||||
break
|
break
|
||||||
return self.results
|
return self.results
|
||||||
|
|
|
@ -3,4 +3,3 @@ destructive
|
||||||
shippable/azure/group2
|
shippable/azure/group2
|
||||||
azure_rm_keyvaultkey
|
azure_rm_keyvaultkey
|
||||||
azure_rm_keyvaultsecret
|
azure_rm_keyvaultsecret
|
||||||
disabled
|
|
||||||
|
|
|
@ -65,6 +65,27 @@
|
||||||
resource_name: "{{ nsgname }}"
|
resource_name: "{{ nsgname }}"
|
||||||
register: output
|
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
|
- name: Create storage account that requires LRO polling
|
||||||
azure_rm_resource:
|
azure_rm_resource:
|
||||||
polling_timeout: 600
|
polling_timeout: 600
|
||||||
|
|
Loading…
Reference in a new issue