mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Implement feature to return list of files in the archive
This commit is contained in:
parent
9dc1f5693c
commit
1ddae11bd1
1 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
||||
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
|
||||
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
|
@ -50,6 +51,13 @@ options:
|
|||
required: no
|
||||
default: null
|
||||
version_added: "1.6"
|
||||
list_files:
|
||||
description:
|
||||
- If set to True, return the list of files that are contained in the tarball.
|
||||
required: false
|
||||
choices: [ "yes", "no" ]
|
||||
default: "no"
|
||||
version_added: "2.0"
|
||||
author: Dylan Martin
|
||||
todo:
|
||||
- detect changed/unchanged for .zip files
|
||||
|
@ -247,6 +255,7 @@ def main():
|
|||
dest = dict(required=True),
|
||||
copy = dict(default=True, type='bool'),
|
||||
creates = dict(required=False),
|
||||
list_files = dict(required=False, default=False, type='bool'),
|
||||
),
|
||||
add_file_common_args=True,
|
||||
)
|
||||
|
@ -296,6 +305,9 @@ def main():
|
|||
file_args['path'] = os.path.join(dest, filename)
|
||||
res_args['changed'] = module.set_fs_attributes_if_different(file_args, res_args['changed'])
|
||||
|
||||
if module.params['list_files']:
|
||||
res_args['files'] = handler.files_in_archive
|
||||
|
||||
module.exit_json(**res_args)
|
||||
|
||||
# import module snippets
|
||||
|
|
Loading…
Reference in a new issue