mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-19 14:50:21 -07:00
Minor Updates to the module descriptions and field options (#25430)
This commit is contained in:
parent
8e3ef4b052
commit
6c3eace794
6 changed files with 79 additions and 12 deletions
|
@ -72,6 +72,7 @@ EXAMPLES = '''
|
|||
path: pool
|
||||
params:
|
||||
name: "{{ pool_name }}"
|
||||
api_version: 16.4
|
||||
register: pool_results
|
||||
|
||||
- name: Patch Pool with list of servers
|
||||
|
@ -81,6 +82,7 @@ EXAMPLES = '''
|
|||
password: "{{ password }}"
|
||||
http_method: patch
|
||||
path: "{{ pool_path }}"
|
||||
api_version: 16.4
|
||||
data:
|
||||
add:
|
||||
servers:
|
||||
|
@ -99,6 +101,7 @@ EXAMPLES = '''
|
|||
password: "{{ password }}"
|
||||
http_method: get
|
||||
path: analytics/metrics/pool
|
||||
api_version: 16.4
|
||||
params:
|
||||
name: "{{ pool_name }}"
|
||||
metric_id: l4_server.avg_bandwidth,l4_server.avg_complete_conns
|
||||
|
@ -159,7 +162,8 @@ def main():
|
|||
path = module.params.get('path', '')
|
||||
params = module.params.get('params', None)
|
||||
data = module.params.get('data', None)
|
||||
|
||||
# Get the api_version from module.
|
||||
api_version = module.params.get('api_version', '16.4')
|
||||
if data is not None:
|
||||
data = json.loads(data)
|
||||
method = module.params['http_method']
|
||||
|
@ -174,7 +178,7 @@ def main():
|
|||
# change the method to be put
|
||||
gparams['name'] = data['name']
|
||||
rsp = api.get(path, tenant=tenant, tenant_uuid=tenant_uuid,
|
||||
params=gparams)
|
||||
params=gparams, api_version=api_version)
|
||||
try:
|
||||
existing_obj = rsp.json()['results'][0]
|
||||
except IndexError:
|
||||
|
@ -193,7 +197,7 @@ def main():
|
|||
gparams['name'] = data['name']
|
||||
using_collection = True
|
||||
rsp = api.get(path, tenant=tenant, tenant_uuid=tenant_uuid,
|
||||
params=gparams)
|
||||
params=gparams, api_version=api_version)
|
||||
rsp_data = rsp.json()
|
||||
if using_collection:
|
||||
if rsp_data['results']:
|
||||
|
@ -211,13 +215,13 @@ def main():
|
|||
cleanup_absent_fields(data)
|
||||
if method == 'patch':
|
||||
rsp = api.get(path, tenant=tenant, tenant_uuid=tenant_uuid,
|
||||
params=gparams)
|
||||
params=gparams, api_version=api_version)
|
||||
existing_obj = rsp.json()
|
||||
|
||||
if (method == 'put' and changed) or (method != 'put'):
|
||||
fn = getattr(api, method)
|
||||
rsp = fn(path, tenant=tenant, tenant_uuid=tenant, timeout=timeout,
|
||||
params=params, data=data)
|
||||
params=params, data=data, api_version=api_version)
|
||||
else:
|
||||
rsp = None
|
||||
if method == 'delete' and rsp.status_code == 404:
|
||||
|
@ -233,7 +237,7 @@ def main():
|
|||
gparams = deepcopy(params) if params else {}
|
||||
gparams.update({'include_refs': '', 'include_name': ''})
|
||||
rsp = api.get(path, tenant=tenant, tenant_uuid=tenant_uuid,
|
||||
params=gparams)
|
||||
params=gparams, api_version=api_version)
|
||||
new_obj = rsp.json()
|
||||
changed = not avi_obj_cmp(new_obj, existing_obj)
|
||||
if rsp is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue