Commit Graph

46 Commits (c5ee1e7ec98ae4fe8b09d85699bdca58a90521cb)

Author SHA1 Message Date
Dag Wieërs a32ae49bb6 Handle special files just like normal files
As discussed in #923
12 years ago
Michael DeHaan ed449ed3e2 Fix indentation 12 years ago
Michael DeHaan 3c2eba57fd Make pep8 tests run against the library directory as well, and associated tweaks (mostly to indentation) in the library
directory.
12 years ago
Michael DeHaan 573616780b Merge pull request #838 from sfromm/issue825
Update file module to not recurse when setting ownership
12 years ago
Stephen Fromm 352f8339ea Update file module to not recurse when setting ownership
This updates set_owner_if_different() and set_group_if_different()
to not implicitly recurse when setting ownership (whether user or
group).  It drops the os.system() call and replaces it with os.chown().
Resolves issue #825.

The recursion should be explicit.  A recurse=yes|no option should be
added to the file module.
12 years ago
Michael DeHaan 046942f4cd Relative symlinks don't really work (module bug) and would be confusing anyway, better to be explicit. 12 years ago
Michael DeHaan 5ed21bf443 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
12 years ago
Michael DeHaan baacde6c74 Add encoding lines to python modules such that they can take unicode options if they are fed them, since the
AnsibleModule stuff no longer base64 encodes for simplicity and speed reasons.
13 years ago
Stephen Fromm c5066ebabf Add setype to file's argument_spec and remove secontext
secontext is used internally and should not be in argument_spec
13 years ago
Stephen Fromm 060a6a2d15 Fix module_fail_json call when symlink src does not exist 13 years ago
Michael DeHaan fb8200b9b9 reinstate invalid argument checks where possible, daisy chainee/chained modules turn it off 13 years ago
Michael DeHaan fe9a05f492 Module consistency and make daisy chaining work with invalid arguments detection. 13 years ago
Michael DeHaan 4782bc1949 Port the file module over to the new common code infrastructure + cleanup some redundant imports since the module code already imports those things. 13 years ago
Jan-Piet Mens 62393ccc7c Fix file module to support = in args; remove superflous call in get_url 13 years ago
Jeremy Smitherman 5107b8354a Removed unused recurse option in file module. 13 years ago
Derek Carter 031af2c0a9 remove UID/GID from output 13 years ago
Derek Carter 11a853377e removed print from debug code of file module 13 years ago
Derek Carter 5119b16c47 file when UID or GID doesn't exist 13 years ago
Fred Alger 9e9dda9e6a Remove unused md5sum function from file module 13 years ago
Michael DeHaan ecdecdb76f capture possible chown stderr output 13 years ago
Michael DeHaan bd16c7c4ac Fix parsing error in file module when returning errors. 13 years ago
Stephen Fromm 67ee30f135 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
13 years ago
Michael DeHaan 473938d1b8 Refactored inventory to make it object oriented, need to make YAML format and executable script
format compatible with this still, and add some tests for INI-style groups of groups
and variables.
13 years ago
Rafal Lewczuk b6be1f5128 Fix: file module does not remove dangling symlinks 13 years ago
Stephen Fromm fa51d4a160 Update how to set default selinux context for file
This removes the 'context' option and replaces it with checks for
'_default' value for seuser, serole, setype, or (maybe) selevel.
If '_default' is provided *and* there is a default context for the given
file, this will set the file context to the available default.
13 years ago
Daniel Néri 546cacd172 File module fix for symlink from relative source path 13 years ago
Michael DeHaan 0841cf4a85 Merge pull request #249 from jhoekx/octal-file-mode
Return the octal mode of a file instead of decimal.
13 years ago
Stephen Fromm 61f63b66ff Update file module selinux-awareness
This adds selinux_mls_enabled() and selinux_enabled() to detect a)
whether selinux is MLS aware (ie supports selevel) and b) whether
selinux is enabled.  If selinux is not enabled, all selinux operations
are punted on -- same as if python's selinux module were not available.
In set_context_if_different(), I now iterate over the current context
instead of the context argument.  Even if the system supports MLS, it
may not return the selevel from selinux.lgetfilecon().  Lastly, this
drops selinux_has_selevel() in lieu of the current approach.
13 years ago
Jeroen Hoekx 3e9159b4d2 Return the octal mode of a file instead of decimal. 13 years ago
Stephen Fromm 41fed6ef0c Fix for issue #227
Older versions of selinux, such as that deployed on rhel5, only return a
context of user:role:type instead of user:role:type:level.  This detects
whether the tuple has three elements (old-style) or four.  If the
old-style, it keeps the secontext list at three elements.
13 years ago
Michael DeHaan 46e8225bbf Fix bug in library/file 13 years ago
Stephen Fromm 332931b9b8 Add context=default option to file module
This adjusts behavior of file module such that removal of se* option
does not revert the file's selinux context to the default.  In order to
go back to the default context according to the policy, you can use the
context=default option.
13 years ago
Michael DeHaan 73412513b8 Fix bug in src. Should not code this early :) 13 years ago
Michael DeHaan d35de23c53 Don't try to expand path for None values 13 years ago
Michael DeHaan ba882d98e1 Call os.path.expanduser in modules so things work as expected even when using ./hacking/test-module script 13 years ago
Stephen Fromm 573d4b4bad Rename serange to selevel to be consistent with selinux docs 13 years ago
Stephen Fromm 5cdcd4b4a3 Add selinux support to file module
This adds the options: seuser, serole, setype, and serange to the file
module.  If the python selinux module doesn't exist, this will set
HAVE_SELINUX to False and punt in the related modules.

This takes the options the user provides and applies those to the
default selinux context as provided from matchpathcon().  If there is no
default context, this uses the value from the current context.  This
implies that if you set the setype and later remove it, the file module
will rever the setype to the default if available.
13 years ago
Michael DeHaan 043815a6e6 Fix syntax error in user patch 13 years ago
Matthew Williams 3404fb4594 protecting against replacing file or directory with link 13 years ago
Matthew Williams ff8750bbdc "link" state in file module 13 years ago
Michael DeHaan 01de08da57 Remove comment about FIXME that is already resolved 13 years ago
Michael DeHaan 557539dda7 Add some comments 13 years ago
Michael DeHaan c4b3979f16 Fix changed=True/False detection when specifying mode= 13 years ago
Michael DeHaan 1d3dd22a02 Disable debug 13 years ago
Michael DeHaan 3aa975aad3 Return file info about the file regardless of changes made 13 years ago
Michael DeHaan 44caf013d5 Initial crack at the file module 13 years ago