Commit Graph

589 Commits (4ebcdf3efda36011050d3f6d9a557be5e67333ec)

Author SHA1 Message Date
peter.jang caaa8e282e fix for rsync protocol (#4211) 8 years ago
David Chwalisz afff84321d file module: add clarification on state=absent re files that do not exist. 8 years ago
Brian Coca 7de287237f stop trying to set permissions in check mode
fixes #4195
8 years ago
Ryan S. Brown 3a04ec5a70 Indent `unarchive` module documentation to fix parsing error. 8 years ago
James Cammarata bfeab3ae1a Merge branch 'feature_10218' into devel 8 years ago
tobixx 3139b90f7e added read-/write-/executeable flags for invoking user (#4130) 8 years ago
James Cammarata 467516e5da Add remote_src param for unarchive to deprecate `copy` param
From ansible/ansible#10218
8 years ago
Dag Wieers 37b7708c5d Fix a problem where the newly provided mode is a string (#3769)
* Fix a problem where the newly provided mode is a string

This fixes #3597

* Implement python3-compatible get_exception() handling
8 years ago
Dag Wieers b66bf8e7a4 Revert PR #3575 since it causes problems related to exclude patterns (#3767)
* Revert PR #3575 since it causes problems related to exclude patterns

By using a different method for getting archive filelists, and extracting we introduced new problems related to excluding based on gtar patterns.

As a result files that would be excluded by gtar, would still be in the filelist. Implementing our own gtar compatible pattern exclusion mechanism is near to impossible (believe me, we looked at it...). The best way is to look at the original problem and deal with that, and ensure that extraction and filelists are done with the exact same tool and exact same options.

The solution is to decode the octal unicode representation in gtar's output back to unicode. Since gtar has no problem extracting these files in LANG=C, we simply has to compensate for it.

This reverts #3575 and fixes #11348.

* Implement codecs.escape_decode() instead of decode("string_escape") for python3
8 years ago
Lukas Grossar 49bf8de27c also match on tabs in ini_file (fixes #106) (#4067)
also match on tabs in ini_file
8 years ago
Toshio Kuratomi 41adb78cab A few more sanity checks for detecting unzip output that's not a file entry (#3982)
* A few more sanity checks for detecting unzip output that's not a file entry

Also note that there's a rounding error somewhere in the mtime
comparison code.

* Fix reference to sub-array
8 years ago
Keisuke Kamada 74864c2d85 Do not copy file if running on check mode 9 years ago
Brian Coca 949916a155 restored incorrectly removed docs, jinja2 override 9 years ago
neo 606598a857 fix unarchive doesn't extract changed tar file #3901 9 years ago
Matt Fischer 1f5335d5e0 Update delete notes for Synrhconize docs (#3723)
The example for delete=yes does not specify recursive although it is
required. In addition, the wording for the delete option is confusing
about from where files are really deleted. This should clarify that.
9 years ago
Dag Wieers 3f7a935932 Improve the unzip output scraping (#3819)
* Improve the unzip output scraping

Ensure we capture the complete file (also when it includes spaces).
Drop lines that do not conform (in length) to what we expect (e.g. header/footer).

This fixes #3813

* Fix how split() works
9 years ago
Brendan Jurd 6448204271 Fix grammar in docs for fetch 'fail_on_missing' (#3872) 9 years ago
Brian Coca b8598748bc Revert "Add prefixing and suffixing fuctionality to assemble"
This reverts commit 4c386dba56.
keeping in sync with main repo revert
9 years ago
Matthias Frey d3a9a90d2d Fixed error in assemble module when validation failed. (#3814)
Error was: TypeError: fail_json() takes exactly 1 argument (2 given)
9 years ago
Chris Houseknecht ca4365b644 Merge pull request #901 from underyx/assemble-with-prefix-and-suffix
Add prefixing and suffixing fuctionality to assemble module
9 years ago
Bence Nagy 4c386dba56 Add prefixing and suffixing fuctionality to assemble 9 years ago
Jan Fader 7c08f10900 fix for #3706 (#3778) 9 years ago
Dag Wieers 9f973aefb1 Add unpack results to error output, for debugging purposes on failure
This may help understand what is going on with #3631
9 years ago
Toshio Kuratomi ca4140134d Python2.4's zipfile library cannot handle zip 64bit extensions which are needed for > 64K files (#3754)
Fallback to unzip if zipfile fails and hope that unzip can deal with it
(sites have an easier time upgrading the unzip utility than all of
python).

https://bugs.python.org/issue3997

Fixes #3560
9 years ago
Marcos Diez 9e197a5f78 The documentation of lineinfile now makes reference to blockinfile (#3639) 9 years ago
Michael Scherer 69ea617093 Convert the whole files/ directory to py3 syntax (#3685) 9 years ago
Michael Scherer de6cdeeba6 Testing the module on freebsd fail, since module is not assigned yet 9 years ago
Michael Scherer 2449267d42 Fix the argument for acl module (#3653) 9 years ago
Dag Wieers 83a3c45a7d Fix small typo (#3642) 9 years ago
Veaceslav Mindru 430e3eeebd add vlidate_certs option for unarchive module (#2635) 9 years ago
Toshio Kuratomi 4a8a292793 bytearray isn't available in python2.4 (#3583)
* Detection of handler depends on the wrong handler failing to list the contents of the tarfile.

Use explicit compression types with the python tarfile library to
achieve that.

* bytearray isn't available in python2.4
9 years ago
Toshio Kuratomi 0ec3b06208 Detection of handler depends on the wrong handler failing to list the contents of the tarfile. (#3584)
Use explicit compression types with the python tarfile library to
achieve that.
9 years ago
Virgil Dupras 82aeaed45d unarchive: use Python's tarfile module for tar listing (#3575)
* unarchive: use Python's tarfile module for tar listing

fixes https://github.com/ansible/ansible/issues/11348

Depending on the current active locale, `tar`'s file listing can end up
spitting backslash-escaped characters. Unfortunately, when that happens,
we end up with double-escaped backslashes, giving us a wrong path,
making our action fail.

We could try un-double-escaping our paths, but that would be complicated
and, I think, error-prone. The easiest way forward seemed to simply use
the `tarfile` module.

Why use it only for listing? Because the `unarchive` option also
supports the `extra_opts` option, and that supporting this would require
us to mimick `tar`'s interface.

For listing files, however, I don't think that the loss of `extra_opts`
support causes problems (well, I hope so).

* unarchive: re-add xz decompression support

Following previous change to use Python's `tarfile` module for tar file
listing, we lost `xz` decompression support. This commits re-add it by
adding a special case in `TarXzArchive` that pre-decompresses the source
file.
9 years ago
Dag Wieers b11f4a51d1 Replace ansible_hostname with inventory_hostname (#3559)
This way these examples can be re-used using the ansible command (and don't require facts gathering).
9 years ago
Michael Scherer 0300b2add1 Remove old test on SELinux (#3510)
since all is done in modules_utils/basic.py, no need to make
the same test here, especially since that's unused later
9 years ago
Dag Wieers 983cdd00bc Making unarchive idempotent (#3307)
* WIP: Making unarchive idempotent

Currently unarchive is not idempotent and has many rough edges and bugs.
The current release is a workable improvement on many fronts:

- zip support is now idempotent (but gtar lacks check-mode)
- New option `exclude` to exclude specific paths/files
- New option `keep_newer` to exclude newer files on target
- New option `extra_opts` to influence unzip/gtar (like synchronize module)

The following items are still ongoing:

- Implement CRC32 support for .zip files
- Re-implement the zip support using native zipfile module
- Re-implement the gtar support using native tarfile/gzip/bz2 modules (lzma external)
- Implement check-mode (works in gzip, but fails using gtar)
- Implement diff-mode (discuss an appropriate output model, like synchronize module)

The re-implementation of unzip/gtar support using native python modules will not only simplify the codebase, additional functionality can be implemented correctly and identically, which is currently not possible. (Other archives could be implemented using native modules equally, incl. options)

* Assorted fixes to zip support (during quality checks)

- Support both rw---- and rwx--- permstr
- Better file type support (more qa needed)
- Symlink support
- Include fix from #3229

* Implement zip diff-mode (itemized change) and avoid changes permissions every time (!)

This commit implements:
- rsync-compatible itemized-change output in diff-mode (using zip)
- no longer changing permissions unconditionally (when idempotent)

* Small fixes to itemized change output

* Fixes to user/group ownership changes

- The implementation of user/group ownership is a bit more complex for idempotency
- We report when a ZIP file incorrectly tags a directory as a file/link
- We only offer diff output when there is a change

* Fix the handling of includes and excludes for unzip

* Remove test output from output (confuses easily)

* Logic and performance improvements to ownership handling, and umask fix

* Handle special files (type '?')

* Make exceptions compatible with python 2.4

* Implement CRC32 support

* Revert some unintended/unknown changes ?

* Taking over maintenance as offered by current maintainer

* Fix support for white-spaces in filenames

* Remove/rename incorrect regex

* Ensure that fat executables end up with execute permission

* Remove check_result from output when unchanged

* When unarchiving as a user, or when owner/group/mode is supplied --diff is insufficient

Only way to be sure is to check request with what is on disk (as we do for zip).
Leave this up to set_fs_attributes_if_different() instead of inducing a (false) change

* By default, don't send confusing check_results in verbose output

This fixes #74.
9 years ago
yarick123 bf2f09e37c ini_file: added option 'noextraspaces' to turn off inserting extra spaces around '=' symbol
* ini_file: added option 'noextraspaces' to turn off inserting extra spaces around '=' symbol

* ini_file: noextraspaces, python 2.4 compatibility

* ini_file: noextraspaces - yes/no => true/false

* ini_file: noextraspaces - added 'version_added' option

* ini_file: noextraspaces => no_extra_spaces
9 years ago
Mengdi Gao 4ff5218903 Improve doc accuracy of template module 9 years ago
peter.jang c52f475c64 added rsync protocol support (#1999)
* added rsync protocol support

* correction for example document(add example for push on delegate)

* use startswith method for safety
9 years ago
Brian Coca a268e5a119 Merge pull request #2647 from bertvv/issue_2498
Also show stdout when validation fails. This fixes #2498
9 years ago
Brian Coca c86a0ef84a fixed exit json 9 years ago
Matt Martz 07f29ecd7f Fix synchronize docs to indicate the correct default for use_ssh_args 9 years ago
Toshio Kuratomi 80543ee6f8 Merge pull request #3197 from dagwieers/unarchive-download-error-fix
unarchive: Ensure that download failure is properly raised before read fails
9 years ago
Brian Coca 94e66cb108 fixes to assemble
now uses atomic move to avoid data corruption
correclty cleans up temp files in every case
returns backup_file info if needed
validate validate before temp file gets created
backup AFTER validate
9 years ago
Dag Wieers 7cd47eb73a Ensure that a download failure is properly raised before the read fails
Without this change, a download failure may bail out with the message:

    "Failure downloading http://foo/bar, 'NoneType' object has no attribute 'read'"

whereas with this fix, you'd get a proper error like:

    "Failure downloading http://foo/bar, Request failed: <urlopen error [Errno 113] No route to host>"

or one of the many other possible download errors that can occur.
9 years ago
Toshio Kuratomi 2920658776 Change one param to be of type path 9 years ago
Toshio Kuratomi 832e81e691 Set some module parameters to type=path 9 years ago
Toshio Kuratomi a7cfa1c8cd Correct dest_port to be of type int 9 years ago
Toshio Kuratomi cfbe65f8c8 Set name to type path so that tilde and env vars are expanded 9 years ago
Brian Coca c50ca43d8d fixed typo, now correctly check isdir
fixes #3089
9 years ago