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
This commit is contained in:
Ricardo Carrillo Cruz 2019-01-16 17:15:50 +01:00 committed by GitHub
parent a79441ca30
commit 1beb6f433b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -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)