Implement feature to return list of files in the archive
This commit is contained in:
parent
a597992592
commit
a19fa6ba48
1 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
||||||
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
|
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
|
||||||
|
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
|
@ -50,6 +51,13 @@ options:
|
||||||
required: no
|
required: no
|
||||||
default: null
|
default: null
|
||||||
version_added: "1.6"
|
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
|
author: Dylan Martin
|
||||||
todo:
|
todo:
|
||||||
- detect changed/unchanged for .zip files
|
- detect changed/unchanged for .zip files
|
||||||
|
@ -247,6 +255,7 @@ def main():
|
||||||
dest = dict(required=True),
|
dest = dict(required=True),
|
||||||
copy = dict(default=True, type='bool'),
|
copy = dict(default=True, type='bool'),
|
||||||
creates = dict(required=False),
|
creates = dict(required=False),
|
||||||
|
list_files = dict(required=False, default=False, type='bool'),
|
||||||
),
|
),
|
||||||
add_file_common_args=True,
|
add_file_common_args=True,
|
||||||
)
|
)
|
||||||
|
@ -296,6 +305,9 @@ def main():
|
||||||
file_args['path'] = os.path.join(dest, filename)
|
file_args['path'] = os.path.join(dest, filename)
|
||||||
res_args['changed'] = module.set_fs_attributes_if_different(file_args, res_args['changed'])
|
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)
|
module.exit_json(**res_args)
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
|
|
Loading…
Reference in a new issue