Commit graph

23 commits

Author SHA1 Message Date
Benjamin Doherty
c0d77be491 Updates to archive module based on code review (#2699)
* Use common file arguments on destination file
* Rename 'compression' to 'format' h/t @abadger
* Add support for plain 'tar' format
* Ensure check_mode is respected
2016-09-13 12:40:07 -04:00
Ben Doherty
07ca593c80 expanduser() on dest 2016-06-01 09:07:18 -04:00
Ben Doherty
a38b510aa8 Refactor computation of archive filenames, clearer archive filename 2016-06-01 08:59:28 -04:00
Ben Doherty
ddfd32774b Don't try to walk over files when building archive 2016-06-01 08:29:28 -04:00
Ben Doherty
b9971f131a Rename 'archive' -> 'arcfile' in compress branch 2016-06-01 08:29:14 -04:00
Ben Doherty
b57b0473cf Change 'creates' parameter to 'dest' 2016-06-01 08:16:31 -04:00
Ben Doherty
0a056eccbf Refactor zip and tarfile loops together, branch where calls are different
This fixed a few bugs and simplified the code
2016-05-31 23:42:37 -04:00
Ben Doherty
ec856c85ad Merge branch 'bendoh-archive-module' of github.com:bendoh/ansible-modules-extras into bendoh-archive-module
* 'bendoh-archive-module' of github.com:bendoh/ansible-modules-extras:
  Add 'default' to docs for 'compression' option
2016-05-31 18:33:32 -04:00
Ben Doherty
726c4d9ba7 Some refactoring:
* rename archive -> arcfile (where it's a file descriptor)
* additional return
* simplify logic around 'archive?' flag
* maintain os separator after arcroot
* use function instead of lambda for filter, ensure file exists before file.cmp'ing it
* track errored files and fail if there are any
2016-05-31 18:31:07 -04:00
Ben Doherty
d5e861b352 Reword comments slightly 2016-05-31 18:30:47 -04:00
Benjamin Doherty
ef620c7de3 Add 'default' to docs for 'compression' option 2016-05-28 09:02:43 -04:00
Ben Doherty
6e0aac888b Documentation updates 2016-05-27 00:07:15 -04:00
Ben Doherty
20bfb1339d Use different syntax in lambda 2016-05-27 00:00:59 -04:00
Ben Doherty
ae35ce5641 Make remove default to false. It's less frightening. 2016-05-26 23:58:17 -04:00
Ben Doherty
6db9cafdec Don't use <x> if <y> else <z> syntax 2016-05-26 23:49:32 -04:00
Ben Doherty
d3e041d1a2 Accept 'path' as a list argument, expose path and expanded_path,
Use correct variable in expanduser
2016-05-26 23:42:03 -04:00
Ben Doherty
cca70b7c91 Fix up for zip files and nesting logic.
* Don't include the archive in the archive if it falls within an archived path
* If remove=True and the archive would be in an archived path, fail.
* Fix single-file zip file compression
* Add more documentation about 'state' return
2016-05-26 23:09:35 -04:00
Ben Doherty
f482cb4790 Add license 2016-05-26 21:41:40 -04:00
Ben Doherty
ecd60f4839 Add compressed file source to successes when succeeds! 2016-05-26 21:38:36 -04:00
Ben Doherty
9cde150bd1 Add RETURN documentation 2016-05-26 21:38:31 -04:00
Ben Doherty
e9b85326a6 Fix write mode for ZipFiles ('wb' is invalid!) 2016-05-26 21:33:27 -04:00
Ben Doherty
431d8c9a8f Drop extra double-quote from documentation 2016-05-26 20:36:14 -04:00
Ben Doherty
cb4173957c Initial commit of extras/archive module.
This manages compressed files or archives of many compressed files. You can maintain or update .gz, .bz2 compressed files, .zip archives, or tarballs compressed with gzip or bzip2.

Possible use cases:

* Back up user home directories
* Ensure large text files are always compressed
* Archive trees for distribution
2016-05-26 19:54:30 -04:00