Commit Graph

23 Commits (66a83314b9d30c6a139de960e6da8d5554c28544)

Author SHA1 Message Date
Matt Martz 66a83314b9
Modernize install (#76021)
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
3 years ago
Sloane Hertel 7cbb53fe9a
Fix test interactions by cleaning up users with the same uid by using 'force: yes' and 'remove: yes' (#75670)
Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Matt Clay ca507ff477 Integration test fixes. 3 years ago
Sloane Hertel 991714b9d1
copy - redact 'content' from invocation in check mode (#71033)
* sanitize copy module invocation secrets in check mode
4 years ago
Rick Elrod 688cd8657b
Fix string/bytestring comparsion in m_u.basic (#70439)
Change:
- module_utils.basic.is_special_selinux_path() used a string ==
  bytestring comparison which returned False and made Ansible think that
  certain filesystems aren't, in fact, special-cased, when they should
  be. Ensure both sides of the == are bytestrings.

Test Plan:
- Added `copy` integration tests for this case.

Tickets:
- Fixes #70244

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Rick Elrod 648b3d43d3
[copy] Add some test coverage for check_mode (#68895)
Change:
Adds some missing coverage for the copy module when `check_mode: True`.

Test Plan:
Ran test with --coverage and looked at the resulting report.

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Matt Clay 9fd244319e
Clean up ansible-test references in tests. (#60108)
* Clean up comments in integration tests.

Tests reference soon to be outdated paths and implementation details.

* Remove unused test/runner/ reference in test.
5 years ago
Matt Martz 737dbefd78
Get copy tests passing with split controller/target (#58516)
* Get copy tests passing with split controller/target

* Remove sudoers file

* add missed set_fact
5 years ago
Martin Krizek 1fa7bfcd5d Fix --diff to produce output when creating a new file (#57744)
* Fix --diff to produce output when creating a new file

Fixes #57618

* Make the check more defensive
5 years ago
Matt Clay f6fbfeace8 Clean up use of `connection: local` in tests. 5 years ago
Martin Krizek d15812fabf
Fix copy module to reset filesystem acls (#51868)
The controller's fixup_perms2 uses filesystem acls to make the temporary
file for copy readable by an unprivileged become user. On Python3, the
acls are then copied to the destination filename so we have to remove
them from there.

We can't remove them prior to the copy because we may not have
permission to read the file if the acls are not present. We can't
remove them in atomic_move() because the move function shouldn't know
anything about controller features. We may want to generalize this into
a helper function, though.

Fixes #44412

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
5 years ago
Matt Clay e2b6047514
Add symlinks sanity test. (#46467)
* Add symlinks sanity test.
* Replace legacy test symlinks with actual content.
* Remove dir symlink from template_jinja2_latest.
* Update import test to use generated library dir.
* Fix copy test symlink setup.
6 years ago
Toshio Kuratomi f332151f59 Fix copy to only follow symlinks for files in the non-recursive case
Revert "**Temporary**"

This reverts commit 28b86b1148.

We don't need this now that copy has been fixed
6 years ago
Jordan Borean 9106284c1c
copy tests: only create recursive symlink in tests (#35073) 6 years ago
Brian Coca bbd6b8bb42 Temporary (#31677)
* allow shells to have per host options, remote_tmp

added language to shell
removed module lang setting from general as  plugins have it now
use get to avoid bad powershell plugin
more resilient tmp discovery, fall back to `pwd`
add shell to docs
fixed options for when frags are only options
added shell set ops in t_e and fixed option frags
normalize tmp dir usag4e

- pass tmpdir/tmp/temp options as env var to commands, making it default for tempfile
- adjusted ansiballz tmpdir
- default local tempfile usage to the configured local tmp
- set env temp in action

add options to powershell
shift temporary to internal envvar/params
ensure tempdir is set if we pass var
ensure basic and url use expected tempdir
ensure localhost uses local tmp
give /var/tmp priority, less perms issues
more consistent tempfile mgmt for ansiballz
made async_dir configurable
better action handling, allow for finally rm tmp
fixed tmp issue and no more tempdir in ballz
hostvarize world readable and admin users
always set shell tempdir
added comment to discourage use of exception/flow control

* Mostly revert expand_user as it's not quite working.

This was an additional feature anyhow.

Kept the use of pwd as a fallback but moved it to a second ssh
connection.  This is not optimal but getting that to work in a single
ssh connection was part of the problem holding this up.

(cherry picked from commit 395b714120522f15e4c90a346f5e8e8d79213aca)

* fixed script and other action plugins

ensure tmpdir deletion
allow for connections that don't support new options (legacy, 3rd party)
fixed tests
6 years ago
Sam Doran a8e4c9be7a Cause copy module to fail on empty string as source (#27975)
* Fail if an empty string is set as src for copy module

Fixes #27363

* Cleanup task formatting on copy tests

Use multi-line YAML
Add debug statements with verbosity: 1 rather than leave them in there commented out.

* Add test for empty string as source

* Do more checks in order to add more specific errors messages

Add more integration tests for the various failure scenarios.
Cleanup some syntax on existing integration test tasks.
7 years ago
Pilou ade593da52 Copy module: improve tests allowing to use a managed host which isn't the controller host (#25672)
* set output_dir_expanded using module result

'path' values are expanded using 'expandvars' too

* foo.txt is located in 'files' directory

* Use 'role_path' and 'connection: local' for local paths

'{{ role_path }}/tmp' is used for generated paths

* Use local connection with local paths

/tmp/ansible-test-abs-link and /tmp/ansible-test-abs-link-dir are
defined by targets/copy/files/subdir/subdir1/ansible-test-abs-link
and targets/copy/files/subdir/subdir1/ansible-test-abs-link-dir links.

* task names: add a suffix when same name is reused

* Check that item exists before checking file mode

then error message is more explicit when item doesn't exist

* Use output_dir_expanded only when necessary

* Enforce remote_user when root is required

* Fix remote path

* Use different local & remote user

this is useful when controller and managed hosts are identical

* Checks must not expect output of tested module to be right

* Use a temporary directory on the controller

* Use sha1 & md5 filters instead of hardcoded values

* Use 'remote_dir' for directory on managed host

* Workaround tempfile error on OS X

Error was:
temp_path = tempfile.mkdtemp(prefix='ansible_')
AttributeError: 'module' object has no attribute 'mkdtemp'"
7 years ago
Toshio Kuratomi 0a2cdb2585 New tests for copy recursive with absolute paths
Absolute path trailing slash handling in absolute directories

find_needle() isn't passing a trailing slash through verbatim.  Since
copy uses that to determine if it should copy a directory or just the
files inside of it, we have to detect that and restore it after calling
find_needle()

Fixes #27439
7 years ago
Toshio Kuratomi f86ce0975d Add a directory walker to copy
* We need a directory walker that can handle symlinks, empty directories,
  and some other odd needs.  This commit contains a directory walker that
  can do all that.  The walker returns information about the files in the
  directories that we can then use to implement different strategies for
  copying the files to the remote machines.
* Add local_follow parameter to copy that follows local symlinks (follow
  is for remote symlinks)
* Refactor the copying of files out of run into its own method
* Add new integration tests for copy

Fixes #24949
Fixes #21513
7 years ago
Toshio Kuratomi 753a3a03d0 Revert "Fix for recursive copy slowness"
This reverts commit 78ced5318f.

The fix for copy slowness did not handle circular symlinks.
7 years ago
Brian Coca 4594bee65a keep unsafe .. unsafe (#23742)
* keep unsafe .. unsafe

fixes #23734, which was broken in previous fix that allowed non string types to be templated
use new 'is_template' function vs bastardizing others
refactored clean_data to allow for arbitrary data structures to clean
fixed/removed some tests

* deal with complex data for is_template

* typos
7 years ago
Toshio Kuratomi 78ced5318f Fix for recursive copy slowness
Copy module was walking over files in subdirectories repeatedly (a
directory tree a few levels deep could bring the time spent into the
tens of minutes)

This was traced to the fix for this bug report: https://github.com/ansible/ansible/issues/13013

Fixed #13013 a different way and added an integration test to check for
regressions of #13013 as we optimize this code.

Fixes #21513
7 years ago
Matt Clay 75e4645ee7 Migrate Linux CI roles to test targets. (#17997) 8 years ago