Commit Graph

36 Commits (4a594b3702b01adccb44babdeadfcdc013a67c26)

Author SHA1 Message Date
Mark Mielke b4a1542670 Reduce the system calls performed by the "file" module
when using "state: link", and particularly when using
"force: yes".

Symbolic link resolution can be expensive. In our case,
the symbolic links are legacy links to automounts, and
the "file" task was causing all of the legacy links to
be traversed and mounted on every host every time the
task executed, even when the links were correct and there
was nothing to do.

This change avoids the system calls that perform the
symbolic link resolution by taking advantage of the short
circuit behaviur of the boolean "and" operator. The code
behaviour is unchanged except that it no longer performs
unnecessary system calls.

As it turns out, this change is not sufficient to fully
solve the symbolic link resolution problem, as the "file"
module still performs a stat() at the end of execution to
provide the caller with information about the file.
However, this change is very simple, it will eliminate
unnecessary system calls in a number of use cases, and it
gets the "file" module closer to the desired end result.
2017-01-24 12:31:25 -08:00
Matt Clay c709b22e5c Fix differences with devel. 2016-12-08 11:35:21 -05:00
Toshio Kuratomi 7319104552 Refreshed metadata for core modules 2016-12-08 11:25:35 -05:00
Fabio Alessandro Locati a5a15acd55 Native YAML - files/file.py (#5799)
* Native YAML - files/file.py

* Rollaback part of the change as for request
2016-12-08 11:25:35 -05:00
jctanner 10f0d3ca95 Set b_src to abspath of b_path so that symlinks work again. (#5678)
Fixes #5653
2016-12-08 11:25:32 -05:00
Sam Doran 895179929c Examples syntax batch6 (#5623)
* Change example syntax on os_auth module

* Change example syntax on os_client_config module

* Change example syntax on os_image_facts module

* Change example syntax on os_networks_facts module

* Change example syntax on os_nova_flavor module

* Change example syntax on os_object module

* Change example syntax on os_server module

* Change example syntax on os_subnet_facts module

* Change example syntax on rax_files module

* Change example syntax on rax_files_objects module

* Change example syntax on mysql_db module

* Change example syntax on file module

* Change example syntax on uri module

* Change example syntax on cl_bond module

* Change example syntax on cl_bridge module

* Change example syntax on cl_img_install module

* Change example syntax on cl_interface module

* Change example syntax on cl_license module

* Change example syntax on cl_ports module

* Remove trailing colon
2016-12-08 11:25:31 -05:00
Sam Doran 0c46813871 Change examples syntax on file module 2016-12-08 11:25:29 -05:00
Toshio Kuratomi 69ec272982 Python3 fixes to copy, file, and stat so that the connection integration tests can be run (#4632)
* Python3 fixes to copy, file, and stat so that the connection integration tests can be run

* Forgot to audit the helper functions as well.

* Fix dest to refledt b_dest (found by @mattclay)
2016-12-08 11:24:59 -05:00
David Chwalisz f979928ecc file module: add clarification on state=absent re files that do not exist. 2016-12-08 11:24:46 -05:00
Michael Scherer f7b29ba8fd Convert the whole files/ directory to py3 syntax (#3685) 2016-12-08 11:24:29 -05:00
Michael Scherer 001ceb8dc6 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
2016-12-08 11:24:20 -05:00
Brian Coca a546775172 fixed typo, now correctly check isdir
fixes #3089
2016-12-08 11:24:07 -05:00
Brian Coca b357f4dd72 added follow to specific modules that support it
was removed from common file docs
2016-12-08 11:24:06 -05:00
Brian Coca 288a5c9a77 adds diff info for file info 2016-12-08 11:23:56 -05:00
Brian Coca 3025451b10 fixed typo EEXISTS is actually EEXIST
fixes #2585
2016-12-08 11:23:50 -05:00
Charles Ferguson 4c93b5dab6 Add documentation to 'file' AnsibleModule definition for internals.
The parameters 'diff_peek' and 'validate' are not expected to be used
by users. They are internal. To make it clear, this change adds the
comments 'Internal use only' to each of those definitions to make
it clear that they are actually used, just not by end-users.
2016-12-08 11:23:50 -05:00
Charles Ferguson e86ba78685 Update documentation for 'file' module to include 'diff_peek'.
The 'diff_peek' option isn't documented at all, and provides a
rudimentary check that the content isn't binary. Documentation is
added to explain the option.

The 'validate' option has a declaration, but isn't implemented.
Therefore it may as well be removed from the module.
2016-12-08 11:23:49 -05:00
varnav a05df49998 Fixed confusion in the docs
As 'path' is actually alias for 'dest', this could be confusing.
2016-12-08 11:23:37 -05:00
Brian Coca e4dd0d98d4 now captures any exceptions when trying to create directories 2016-12-08 11:23:21 -05:00
Matthew Gilliard 17a40aa259 Handle race condition in directory creation.
If we try to make a directory, but someone else creates the directory
at the same time as us, we don't need to raise that error to the user.
They asked for the directory to exist, and now it does. This fixes
the race condition which was causing that error to be raised, and
closes #1648.
2016-12-08 11:23:16 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Tristan Fisher 75ef963922 removes bool type from validate. 2016-12-08 11:23:03 -05:00
Tristan Fisher 0180be25c4 standardizes bools in argument_spec 2016-12-08 11:23:03 -05:00
Greg Taylor 79dd0466b5 Adding directory creation example to file module. 2016-12-08 11:23:00 -05:00
Brian Coca b4775234c9 minor docfix 2016-12-08 11:23:00 -05:00
James Bowes 0d3aed3e1f Fix C() formatting typo in file module 2016-12-08 11:22:48 -05:00
Brian Coca d6305bc938 fixed file module to use realpath when following links, readlink could be relative and fail in corner cases as per #852 2016-12-08 11:22:45 -05:00
Toshio Kuratomi af6c625cc2 When recursing subdirectories, honor the follow parameter for setting file attributes.
One half of the fix for
https://github.com/ansible/ansible-modules-core/issues/778
The other half is in basic.py
2016-12-08 11:22:42 -05:00
Rahul Mehrotra fe08f52d92 Fixed Documentation issue concerning file mode when specified using numberical value 2016-12-08 11:22:42 -05:00
Brian Coca a3de4db57d fix for allowing permissions on hard links and soft links + follow=yes 2016-12-08 11:22:37 -05:00
Brian Coca 9eb77bdb4f fix for when state=directory, follow=yes and target is symlink to directory 2016-12-08 11:22:37 -05:00
Jesse Buchanan 06a58dcad7 Files module: Allow touch on hardlinks 2016-12-08 11:22:36 -05:00
sysadmin75 7fbb422ae7 Fixes #9518 - "file state=directory" silently skips if it's currently a file 2016-12-08 11:22:33 -05:00
Toshio Kuratomi f7fafa8c16 Cannot readlink() on a hard link 2016-12-08 11:22:27 -05:00
Toshio Kuratomi bcc058249c Use original_basename to set the dest path even if src is not set 2016-12-08 11:22:24 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00