Commit Graph

80 Commits (74cbeb1292a439a233c5bfd04c2687163b0d17e7)

Author SHA1 Message Date
Michael DeHaan 645ab7baff Merge pull request #7950 from mesk41in/devel
Fix unsupported regexp parameter in assemble
2014-07-28 12:01:12 -04:00
Michael DeHaan fb60e767a7 Taking alternate approach.
Revert "Fix hostname when get_distribution_version() returns a string."

This reverts commit 08f97c0b9d.
2014-07-28 11:35:33 -04:00
Michael DeHaan 628d828876 Merge pull request #8087 from neersighted/string_version
Fix hostname when get_distribution_version() returns a string.
2014-07-28 11:24:58 -04:00
Michael DeHaan 630f080cf0 Start of unit tests for split_args function, moved split_args to utils since not needed by modules (so far). 2014-07-24 20:15:04 -04:00
Michael DeHaan b5d64fdb36 Some notes/comment upgrades on split_args. 2014-07-24 16:34:06 -04:00
James Cammarata 43154e5101 Using custom splitting function for module param counting 2014-07-24 14:42:35 -05:00
James Cammarata 84759faa09 Security fixes:
* Strip lookup calls out of inventory variables and clean unsafe data
  returned from lookup plugins (CVE-2014-4966)
* Make sure vars don't insert extra parameters into module args and prevent
  duplicate params from superseding previous params (CVE-2014-4967)
2014-07-21 11:20:49 -05:00
Ruggero Marchei 909955f2e2 fix get_distribution_version() on amazon linux 2014-07-15 18:04:46 +02:00
Bjorn Neergaard 08f97c0b9d Fix hostname when get_distribution_version() returns a string.
The distro version is a string ('jessie/sid') on Debian unstable and testing.
Because load_platform_subclass() evaluations every subclass as it loops,
comparing numbers when get_distribution_version() does not return a number will
break.

This patch fixes that by returning a number (`0`) when we have an invalid
version, instead of returning `None` or a string.
2014-07-10 11:27:03 -07:00
James Cammarata 81f35323e9 Revert "Fix get_distribution() for platforms that may have spaces"
This reverts commit 2493020d9f.
2014-07-02 09:44:44 -05:00
mesk41in 488aec3936 Fix unsupported regexp parameter in assemble 2014-06-27 13:54:59 +04:00
James Cammarata 3c3c710a58 Merge branch 'module_safe_eval' into fix_lineinfile_newlines 2014-06-20 00:16:52 -05:00
James Cammarata 2493020d9f Fix get_distribution() for platforms that may have spaces
The new CentOS 7 beta lists the distribution as "CentOS Linux", which
breaks the distribution detection and class loading. This patch fixes
that by taking just the first entry in the string when a space is
detected.
2014-06-18 13:10:39 -05:00
Ruggero Marchei e3f5af377f move get_distribution_version() to basic.py 2014-06-17 10:22:14 +02:00
James Cammarata b4d130d086 Add a new password pattern to the run_command filter 2014-06-12 07:42:25 -05:00
James Cammarata 849b0f87ce Fix error when using os.getlogin() without a tty 2014-06-03 09:36:19 -05:00
James Cammarata e99df21647 Support checking for su user to atomic_move
Fixes #7553
2014-05-27 16:04:02 -05:00
James Cammarata 0ac74aaf59 Also set the environment variables when resetting the locale to C 2014-05-19 23:22:46 -05:00
James Cammarata 285d9878ae Reset locale to 'C' if the specified one is invalid
Fixes #7448
2014-05-19 10:26:06 -05:00
James Cammarata df877f2e79 Check module_path permissions when creating ssh_wrapper for git
If the module directory is not writable/executable to the current user
(most likely because of a sudo to a non-root user), the ssh_wrapper
will be created in the default location for mkstemp() calls. To facilitate
the deletion of these new files, a new mechanism for cleaning up files
created by the module was also added.

Fixes #7375
2014-05-14 21:22:22 -05:00
James Cammarata 56515a38d5 Only chown on atomic move if the uid/gid don't match the src/tmp file
This is a corner case for remote file systems that don't support
chown() and where the source and destination for the atomic_move
are on that remote file system.

Fixes #7372
2014-05-14 09:59:12 -05:00
James Cammarata 54b1f820fb Modify the way we set the localization environment
Previously, we set the LANG (and LC_CTYPE) environment variables
directly in the module code and applied them with os.environ().
Instead, we are now pre-pending those variables to the environment
string used to execute the command which allows the user to
override the localization values by setting the environment values
directly (even on a per-task basis):

  - subversion: repo=file:///path/to/repos/svn_über dest=/tmp/svntest
    environment:
      LANG: "C"
      LC_CTYPE: "en_US.UTF-8"

So if a user wishes to default their LANG back to C, they can still
avoid unicode issues by doing the above.

Fixes #7060
2014-05-01 10:34:53 -05:00
Jiri Barton 9da06274a8 Set proper file permisions when a file is created with atomic_move
Fixes #7196
2014-04-29 08:41:22 -05:00
Michael DeHaan 9a6998aa17 While this code is unused, this remote module copy of this function should not be carried around in the source code. 2014-04-29 08:12:11 -04:00
James Cammarata c115c34a1f Set the default LANG to en_US.UTF-8 and also set LC_CTYPE
Fixes #6737
2014-04-22 00:48:32 -05:00
James Cammarata 68c30548e0 Properly catch and decode unicode strings in module _log_invocation()
Fixes #7084
2014-04-21 11:33:23 -05:00
James Cammarata 3715482d7c Determine selinux context for NFS mount points correctly
Fixes #7009
2014-04-18 09:39:58 -05:00
James Cammarata 23c5f4524d Make sure args in run_command are encoded for shlex.split calls on py2.6 2014-04-15 13:04:41 -04:00
James Cammarata 9ca8c3262c Switch module safe_eval to ast.literal_eval 2014-04-08 09:05:07 -05:00
James Cammarata 82b24c162e Adding delimiter fixes to action_plugin + fixing local assembling with a delimiter
Also added a new integration test for assemble using local assembly
with a delimiter.
2014-04-03 16:32:35 -05:00
Harlan Lieberman-Berg 876b8085aa Add directory_mode to common file parameters to prevent errors. 2014-04-02 17:41:39 -04:00
Michael DeHaan a6b25e8657 Allow type=list module arguments to accept integers and floats. 2014-03-28 11:19:49 -04:00
James Tanner 3194fbd365 Fixes #6655 catch unicode encoding errors before sending to syslog 2014-03-25 16:07:12 -04:00
James Cammarata 4ea12c1b86 Make sure stat of dest is available in atomic_move
Fixes #6682
2014-03-25 14:03:21 -05:00
Sébastien Gross ef6b437d0d Fix TypeError when using old simplejson lib.
On some very old simplejson does not support the 'encoding' and give
following exception:

   TypeError: __init__() got an unexpected keyword argument 'encoding'

This fix runs json.dump with no encoding key (such as before #a023cb) on
TypeError exception only.
2014-03-25 14:50:29 +01:00
James Cammarata db345391e3 Fixing ownership when atomic_move is creating a file while sudo'ing
Fixes #6647
2014-03-24 15:10:43 -05:00
James Cammarata bb723bedee Merge branch 'atomic_move_restore_owner_group_rebase' of https://github.com/tyll/ansible into tyll-atomic_move_restore_owner_group_rebase 2014-03-24 09:34:51 -05:00
Till Maas 898a38b074 module_utils/atomic_move(): Use tempfile module
Fix a potential race condition by using the tempfile module.
2014-03-20 12:34:19 +01:00
Till Maas 8f778a83df module_utils/atomic_move(): Restore owner/group
Manually restore owner and group if both src and dest are on a separate
file system.
2014-03-20 12:34:19 +01:00
James Tanner 67517e96d3 Fixes #6567 put the git wrapper script in the module temp dir 2014-03-19 10:30:10 -04:00
James Cammarata 3f5440f7df Make modules set a valid working directory
Fixes #6546
2014-03-18 10:37:52 -05:00
Brian Coca 2d25577e11 Fixes and cleanup to file functions and module
- unified set attribute functions ... not sure why 2 identical functions
exist with diff names, now there are 3 while i repoint all modules to 1
- fixed issue with symlinks being created w/o existing src when force=no
- refactored conditionals, simplified where possible
- added tests for symlink to nonexistant source, with both force options
- made symlink on existing attomic (force)
2014-03-15 13:54:24 -04:00
James Cammarata a0cb974575 Be sure to return to the old directory if cwd is set in run_command 2014-03-13 16:24:29 -05:00
James Tanner a348f67238 Reset the current directory after running subprocess.Popen 2014-03-13 17:15:23 -04:00
James Cammarata 677008bef7 Rejoin args list into a string for run_command when using an unsafe shell
This allows the use of an args list with leading environment variables,
which otherwise would fail due to the way Popen works.
2014-03-13 14:31:32 -05:00
James Cammarata 5233d4bc31 Fix typo in run_command when sending data that is not binary 2014-03-13 14:28:51 -05:00
James Cammarata b1a37dcc08 Revert "Rejoin args list into a string for run_command when using an unsafe shell"
This reverts commit 4273cb2d8e.
2014-03-13 14:04:51 -05:00
James Cammarata 4273cb2d8e Rejoin args list into a string for run_command when using an unsafe shell
This allows the use of an args list with leading environment variables,
which otherwise would fail due to the way Popen works.
2014-03-13 13:51:59 -05:00
James Cammarata 303e085f8b Only use cwd in run_command kwargs if the directory exists 2014-03-12 15:59:55 -05:00
James Cammarata 60a7f57300 Make sure the cwd exists in run_command before trying to use it 2014-03-12 14:33:31 -05:00