Coverage for plugins/modules/attachment_info.py : 95%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2022, XLAB Steampunk <steampunk@xlab.si> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
module: attachment_info
author: - Polona Mihalič (@PolonaM)
short_description: a module that users can use to download attachment using sys_id
description: - Download attachment using attachment's sys_id. version_added: 2.0.0 extends_documentation_fragment: - servicenow.itsm.instance
options: dest: description: - Specifies the path in which the attachment will be downloaded to. - The file will be downloaded to all of the hosts from the inventory. - All the directories on the path should already exist. - If the file at the destination path already exists, it will be overwritten. type: path required: true sys_id: description: - Attachment's sys_id. type: str required: true
notes: - Supports check_mode. """
- name: ServiceNow download attachment module servicenow.itsm.attachment: instance: host: https://instance_id.service-now.com username: user password: pass dest: /tmp/sn-attachment sys_id: 003a3ef24ff1120031577d2ca310c74b """
record: description: download attachment record returned: success type: dict contains: elapsed: description: the number of seconds that elapsed while performing the download returned: success type: float sample: 2.3 msg: description: OK or error message returned: always type: str sample: OK size: description: size of the attachment in bytes returned: success type: int sample: 1220 status_code: description: the HTTP status code from the request returned: success type: int sample: 200 """
arguments, client, attachment, errors, )
"size": size, "elapsed": elapsed, "status_code": status_code, "msg": msg, # add sys_id }
arguments.get_spec("instance"), # Overwrites sys_id from SHARED_SPECS to add required=True sys_id=dict( type="str", required=True, ), dest=dict( type="path", required=True, ), )
argument_spec=module_args, supports_check_mode=True, )
module.fail_json(msg=str(e))
main() |