Add object_type param to checkpoint_object_facts (#50982)

* Add object_type param to checkpoint_object_facts

* Add changelog fragment

* Fix sanity

* Fix sanity

* Pass type param to payload

Otherwise it does not do what is expected to do

* Add ip-only default to docstring
pull/51016/head
Ricardo Carrillo Cruz 6 years ago committed by GitHub
parent a79441ca30
commit 1beb6f433b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
---
minor_changes:
- "add parameter to checkpoint_object_facts to filter out by object type"

@ -50,6 +50,10 @@ options:
- Filter only by IP address.
type: bool
default: false
object_type:
description:
- Type of the object to search. Must be a valid API resource name
type: str
"""
EXAMPLES = """
@ -77,12 +81,13 @@ def get_object(module, connection):
uid = module.params['uid']
object_filter = module.params['object_filter']
ip_only = module.params['ip_only']
object_type = module.params['object_type']
if uid:
payload = {'uid': uid}
code, result = connection.send_request('/web_api/show-object', payload)
else:
payload = {'filter': object_filter, 'ip-only': ip_only}
payload = {'filter': object_filter, 'ip-only': ip_only, 'type': object_type}
code, result = connection.send_request('/web_api/show-objects', payload)
return code, result
@ -91,8 +96,9 @@ def get_object(module, connection):
def main():
argument_spec = dict(
uid=dict(type='str', default=None),
object_filter=dict(type='str'),
ip_only=dict(type='bool', default=False)
object_filter=dict(type='str', default=None),
ip_only=dict(type='bool', default=False),
object_type=dict(type='str', default=None)
)
module = AnsibleModule(argument_spec=argument_spec)

Loading…
Cancel
Save