Commit graph

5564 commits

Author SHA1 Message Date
James Cammarata
ec56b29ba4 Fix setting of interpreter values for delegated hosts
Fixes #12772
2015-10-21 11:05:45 -04:00
Toshio Kuratomi
c845181dc1 In v2, exec_command should return bytes and the caller will take responsibility for converting to unicode 2015-10-21 07:59:46 -07:00
gduke
744679601f Remove mutable default arguments. 2015-10-20 22:13:23 -07:00
Toshio Kuratomi
10e2fc6f60 Update submodule ref 2015-10-20 15:37:50 -07:00
Toshio Kuratomi
1126ce34e3 Merge pull request #12846 from ansible/nolog-for-return-value
Hide values in json returns which were given in parameters marked no_log.
2015-10-20 15:28:16 -07:00
Toshio Kuratomi
c2d188baff Hide values in json returns which were given in parameters marked no_log. 2015-10-20 12:42:36 -07:00
James Cammarata
3ddda2f460 Merge pull request #12842 from mcsalgado/include_with_items
Revert back to copying self._task.args
2015-10-20 15:33:34 -04:00
Brian Coca
1ecad5aed2 now galaxy correctly detects empty requirements file
also allow for 'scm' and 'src' not to be populated in requirements entries
2015-10-20 14:39:22 -04:00
Victor Salgado
c5c5f3bf7a Revert back to copying self._task.args 2015-10-20 16:21:25 -02:00
Victor Salgado
0e671baa33 Fix typo 2015-10-20 16:18:01 -02:00
James Cammarata
b46ce47a84 Don't use local transport for delegated hosts if the inventory_hostname isn't local
For some situations like Vagrant, the remote_addr may be a localhost addr, but ssh
is still desired. This corrects the assumption that any localhost remote_addr should
be using the local connection by checking the inventory_hostname value as well.

Fixes #12817
2015-10-20 14:04:39 -04:00
Toshio Kuratomi
99e7bb35c1 Simplify UnsafeProxy as we don't need to use it for byte strings, only text 2015-10-20 10:57:23 -07:00
James Cammarata
3c87c44af5 Fixing bug in includes caused by 892d9b8
Fixes #12837
2015-10-20 13:49:52 -04:00
Toshio Kuratomi
31ebafcbdd Update submodule refs 2015-10-20 09:22:58 -07:00
Toshio Kuratomi
f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
Brian Coca
de3ca57a33 avoid relative shlex import
fixes #12777
2015-10-19 19:55:22 -04:00
James Cammarata
e5b6d802bf Removing some cruft related to _local_action value on Task, which was removed
Fixes #12819
2015-10-19 16:52:27 -04:00
Mathieu
260a3e5ce7 Fixes #11055 - Set locale via LC_ALL 2015-10-19 21:25:30 +02:00
Toshio Kuratomi
923fc9fb15 Cleanup pyflakes warning (real error) 2015-10-19 12:01:01 -07:00
Toshio Kuratomi
7aa9f6754a Cleanup more pyflakes warnings (2 real problems) 2015-10-19 12:01:01 -07:00
James Cammarata
1fa975d81a Simplify group_by by removing BYPASS_HOST_LOOP from the action
Fixes #12825
2015-10-19 14:57:07 -04:00
Toshio Kuratomi
0888d78b84 Cleanup some pyflakes warning (1 real error) 2015-10-19 11:42:46 -07:00
Toshio Kuratomi
c6d44738ad Clean up some more pyflakes warnings 2015-10-19 11:35:10 -07:00
Toshio Kuratomi
3da8bab3ff Cleanup pyflakes warning (real error) 2015-10-19 11:29:51 -07:00
Toshio Kuratomi
a526eae543 Clean up a few more pyflakes warnings 2015-10-19 11:20:21 -07:00
Toshio Kuratomi
a17ae6f07e Clean up pyflakes warnings in inventory 2015-10-19 11:13:56 -07:00
James Cammarata
892d9b8dfb Move post_validate for tasks after checking for an include
Simplifies logic and prevents us from accidentally post_validating
an include that would otherwise be skipped due to tags causing a
problem because of potentially missing variables.

Fixes #12793
2015-10-19 13:42:17 -04:00
James Cammarata
1cfd941179 Adding a v2 callback for task includes 2015-10-19 13:42:17 -04:00
Toshio Kuratomi
dc33d30c6d Update submodule refs 2015-10-19 10:25:36 -07:00
Toshio Kuratomi
b67e51ea06 Information on when to use to_str() and what a native string is 2015-10-19 09:28:43 -07:00
Toshio Kuratomi
39d9bc3564 Update submodule refs 2015-10-19 09:09:07 -07:00
Toshio Kuratomi
6ce6b20268 Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data. 2015-10-19 09:08:25 -07:00
Brian Coca
1280e2296c changed warning to debug and expanded info on what is really happening, it was a bit misleading 2015-10-18 11:00:50 -04:00
Brian Coca
2d1d21228a updated skippy to match default output 2015-10-18 11:00:50 -04:00
James Cammarata
0bbe9d5bd0 Make hostvars json/yaml serializable in filters
Fixes #12615
2015-10-18 10:09:05 -04:00
James Cammarata
a88c59f451 Reset basedir for plays that are not from a PlaybookInclude
Fixes #12524 (again)
2015-10-17 12:44:28 -04:00
James Cammarata
0aa018337a Fixing logic in json cache plugin get()
Fixes #12722
2015-10-17 11:50:14 -04:00
James Cammarata
5f617c601b Remove obsolute tag evaluation in free strategy
Fixes #12784
2015-10-17 11:29:39 -04:00
Brian Coca
6c8cf8acb7 now profile_tasks callback handles handlers correctly
fixes #12762
2015-10-16 18:01:27 -04:00
James Cammarata
1ab0e0e228 Disable RuntimeWarnings during all() plugin loading
Fixes #12778
2015-10-16 15:34:49 -04:00
Brian Coca
71ffb86c30 don't let cowsay issues stop execution
fixes #12773
2015-10-16 15:20:59 -04:00
Brian Coca
6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
2015-10-16 15:05:23 -04:00
Toshio Kuratomi
a567f28657 Update submodules for docs fixes# Please enter the commit message for your changes. Lines starting 2015-10-16 11:12:21 -07:00
Toshio Kuratomi
5d8ab9b01b Update module refs 2015-10-16 10:05:57 -07:00
Toshio Kuratomi
b23a083776 Make vault use a mapping of cipher name to classes instead of formatting the name for safety. 2015-10-16 10:05:27 -07:00
Toshio Kuratomi
baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Lars Kellogg-Stedman
aa0b7536c9 correct value of remote_user for local connections
When using 'local' connections, privilege escalation would fail if
ansible_ssh_user was in the current context to the same value as
become_user.

This commit ensures that for 'local' connections we reset remote_user to
the local username.

This fixes #12782.
2015-10-16 11:17:58 -04:00
Toshio Kuratomi
28c933ce5e properly fail_json when we don't have ssl on a non-redhat distro 2015-10-16 08:06:32 -07:00
Marius Gedminas
98958ec990 Simplify join expression 2015-10-16 17:39:27 +03:00
Marius Gedminas
56184a3d8c Python 3: avoid %-formatting of byte strings
This is needed for Python 3.4 compatibility; Python 3.5 can use
`b'%s\n' bytestring` again.
2015-10-16 17:18:35 +03:00
Brian Coca
9b088a1e40 implemented inventory_hostname lookup in v2 2015-10-15 13:11:42 -04:00
Brian Coca
aee6de5a76 group_names should not include implied 'all', fixes #12763 2015-10-15 11:46:43 -04:00
James Cammarata
dce58a78c9 Make random cowsay truly random
Also adds a cowsay whitelist config option, because there are some
truly NSFW stencils that come with cowsay by default.
2015-10-15 10:52:53 -04:00
Marius Gedminas
4fb6f62f1b Fix Unexpected Exception: global name 'os' is not defined
I inadvertently introduced it in
ca826508d9 and didn't notice, because
there are no unit tests for playbook_executor.py.  Sorry!

(The "from ansible.errors import *" was used *only* to get the 'os'
module, which makes go "what?")
2015-10-15 10:41:00 +03:00
Marius Gedminas
ab569cea22 Move to_str alias into ansible.utils.unicode
@abadger suggested on IRC that it's useful enough to go into
ansible.utils.unicode.
2015-10-15 10:27:38 +03:00
Marius Gedminas
ca826508d9 Python 3: fix AnsibleError formatting
If you convert the error string to bytes and embed it inside another
error string, you get

  Prefix:

  b'Embedded\nerror\nstring'

which is not what we want.

But we also don't want Unicode in error messages causing unexpected
UnicodeEncodeErrors when on Python 2.

So let's convert the error message into the native string type (bytes on
Python 2, unicode on Python 3).
2015-10-15 09:38:14 +03:00
Toshio Kuratomi
5617f6aad4 Update synchronize to use the correct host when delegating
Fixes #12752
2015-10-14 18:57:10 -07:00
Toshio Kuratomi
85abd61001 Add some more info to docstring 2015-10-14 18:57:10 -07:00
James Cammarata
d923d05a33 Reworking the way all() works in plugin_loader
* Don't throw away the full path of the module code being loaded,
  as this can cause conflicts when files of the same name are being
  instantiated
* Generalize the module loading code

Fixes #12738
2015-10-14 17:53:28 -04:00
James Cammarata
45b803efb4 Properly use test_loader from SharedPluginLoaderObj 2015-10-14 17:53:28 -04:00
Toshio Kuratomi
c8ad55103e Update extras modules ref to fix docs 2015-10-14 08:44:37 -07:00
Toshio Kuratomi
e00eeba9c3 Update submodule refs 2015-10-14 08:06:55 -07:00
James Cammarata
91b0b4d40c Check is_directory() before not is_file() in inventory basedir
Fixes #12742
2015-10-14 11:03:10 -04:00
Brian Coca
c57200925f made syslog import optional as intel's edison custom compiles python w/o it 2015-10-14 09:12:02 -04:00
James Cammarata
ee559e03f7 Merge pull request #12725 from mgedmin/py3k
Python 3: there's no basestring
2015-10-13 16:52:46 -04:00
James Cammarata
e6d3c6745f Revert to using local file/dir tests in inventory instead of loader's
Fixes #12719
2015-10-13 12:04:01 -04:00
Brian Coca
c637d60a8d fixed deprecation message 2015-10-13 11:40:21 -04:00
Brian Coca
f5227d494b added missing cachefile and changed str(e) to to_bytes(e) 2015-10-13 11:15:10 -04:00
Marius Gedminas
9ba6c087d3 Python 3: there's no basestring 2015-10-13 09:56:12 +03:00
Marius Gedminas
f03da5be42 Python 3: there's no iteritems() 2015-10-13 09:47:16 +03:00
James Cammarata
2d77c643e4 Merge pull request #12723 from mgedmin/py3k
Make ansible.vars.unsafe_proxy Python 3 friendly
2015-10-13 02:45:55 -04:00
Marius Gedminas
e511d6d458 Make UnsafeProxy work on Python 3
Instead of str and unicode we have to deal with bytes and str.
2015-10-13 09:41:08 +03:00
Marius Gedminas
af6a316d9b Remove unused import
Fixes ImportError: No module named '__builtin__' on Python 3.
2015-10-13 09:37:48 +03:00
James Cammarata
426187489f Add variable for format parameter 2015-10-13 02:33:18 -04:00
Toshio Kuratomi
8277747a04 Fix password lookup when password file exists and the password is not encrypted 2015-10-12 15:52:03 -07:00
James Cammarata
cd2cb178ae Totally rework the way UnsafeProxy does things 2015-10-12 18:13:09 -04:00
Toshio Kuratomi
15d7f53846 AnsibleModules.log() fix for python3
Also add unittests for AnsibleModules.log()

Fixes #12586
2015-10-12 13:30:27 -07:00
Toshio Kuratomi
b49e0995cb Fix typo 2015-10-12 13:29:04 -07:00
Toshio Kuratomi
b58d7470d4 Cleanup logic and be more paranoid about passwords with spaces 2015-10-12 12:55:33 -07:00
James Cammarata
5c5806d669 Fixing bugs related to jfonfile cache plugin
* corrupt/invalid file causes tracebacks
* incorrect initialization of display/_display in BaseCacheModule class
* tweaking the way errors in get() on jsonfile caches work, to raise
  a proper AnsibleError in that situation so the playbook/task is stopped

Fixes #12708
2015-10-12 13:06:41 -04:00
Toshio Kuratomi
b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 2015-10-12 10:06:13 -07:00
James Cammarata
d15fcf05f0 Fix bug in the way temp vars were created for templating vars_files
Fixes #12711
2015-10-12 12:17:45 -04:00
Brian Coca
f5f3bf06e4 Merge pull request #12550 from redrampage/remove-pw-salt-deletion
Removed deletion of salt by 'password' lookup
2015-10-12 11:33:19 -04:00
James Cammarata
73661d1761 Merge branch 'devel' of https://github.com/ansible/ansible into devel 2015-10-12 11:30:03 -04:00
Charles Paul
3d533cb423 fixing calls to fail_json 2015-10-12 08:50:18 -05:00
Brian Coca
50372eecc9 Merge pull request #12455 from privateip/devel
added methods for retrieving vapp and vm
2015-10-12 09:37:47 -04:00
James Cammarata
82e76e42e5 Tweak to the way serial percentages are handled 2015-10-12 09:00:43 -04:00
James Cammarata
63e288354e Fix bug in way omitted values were set 2015-10-12 09:00:27 -04:00
James Cammarata
4c85ae0712 Merge branch 'serial_should_be_string' of https://github.com/klshxsh/ansible into klshxsh-serial_should_be_string 2015-10-12 08:28:07 -04:00
klshxsh
ac00c9ced7 changed 'string' to 'percent' for _serial
Note that this allows both integers (e.g. 3) and percentages (e.g. "30%")
Also changed default back to 0 rather than '0'
2015-10-12 12:41:00 +01:00
James Cammarata
eb60ce1b6e Merge pull request #12703 from keitwb/inventory_file_var
Adding the inventory_file var back
2015-10-11 16:04:34 -04:00
James Cammarata
71a1a3c903 Submodule pointer update 2015-10-10 22:31:54 -04:00
Ben Keith
1f82971283 Adding the inventory_file var back 2015-10-10 21:54:28 -04:00
Toshio Kuratomi
45a161b0a1 Merge pull request #12429 from edmstudio/devel
Update synchronize module plugin to work on OS X
2015-10-09 16:05:46 -07:00
Petr Mifek
6e035a3e94 Move nested function test for ipv6 to top level in synchronize module. 2015-10-10 00:01:22 +02:00
Brian Coca
45788fbfad <homer>doh!</homer> 2015-10-09 16:58:01 -04:00
Brian Coca
d24532757c remove fix for local_action/connection local that is now not needed 2015-10-09 16:53:17 -04:00
klshxsh
4a5e52b2d2 The serial keyword can be specified as a percentage, e.g '30%' or a number e.g. '3'; therefore it needs to be a string to allow both types 2015-10-09 21:34:37 +01:00
Brian Coca
b9d54e9a01 corrects previous fix to deal with missing item key in results dict 2015-10-09 13:01:32 -04:00
Brian Coca
abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
2015-10-09 13:01:32 -04:00
Brian Coca
101c8785ec removed changes to make local action equate connection=local and brought it back to equate delegate_to=localhost 2015-10-09 13:01:32 -04:00
Brian Coca
bcb173996b Merge pull request #12695 from matburt/fix_cache_plugins_for_v2
Fix an issue where cache plugins weren't updated in certain scenarios
2015-10-09 11:39:58 -04:00
Brian Coca
fbf4cafab5 on skipped you 'might' not have an item, changed to getattr to avoid keyerror
fixes #12683
2015-10-09 11:28:11 -04:00
Matthew Jones
7da478a4f4 Fix an issue where cache plugins weren't updated
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__.  This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
Brian Coca
ec02b255c3 Merge pull request #12689 from soarpenguin/bugfix
Remove some warning of undefined name and fix classmethod syntax error.
2015-10-09 11:09:50 -04:00
James Cammarata
770032648a Show -> localhost for local_action tasks 2015-10-09 10:53:53 -04:00
James Cammarata
f415d39dfd Merge pull request #12690 from stelligent/devel
Use AWS_DEFAULT_REGION env var if none specified
2015-10-09 10:02:48 -04:00
James Cammarata
cfa62e7a2a Submodule pointer update 2015-10-09 09:50:16 -04:00
James Cammarata
868819f9fa Make sure shlex split is returning properly encoded strings
Fixes #12676
2015-10-09 09:49:27 -04:00
Shayne Clausson
55b3f9e4e5 Use AWS_DEFAULT_REGION env var if none specified 2015-10-09 10:27:36 +02:00
soarpenguin
b11ea17385 fix classmethod syntax error. 2015-10-09 12:46:31 +08:00
soarpenguin
5efa4d29e3 fix some warning of undefined name. 2015-10-09 12:43:42 +08:00
James Cammarata
59d655c543 Double echo temp directory name to handle spaces and ~ expansion both
Fixes #12667
2015-10-08 16:22:38 -04:00
Toshio Kuratomi
d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
Toshio Kuratomi
2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
Toshio Kuratomi
01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca
76feba00c4 avoid callbacks during syntax check and listing
fixes #12682
2015-10-08 10:15:48 -04:00
Brian Coca
4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
James Cammarata
de792ba3c2 Improve handling of unicode errors
Fixes #12669
2015-10-08 10:04:15 -04:00
James Cammarata
5a0f5f1254 Load vars for localhost when created implicitly
Fixes #12666
2015-10-08 09:26:20 -04:00
Brian Coca
d8769c93c7 updated ec2 region description to add missing other env var 2015-10-07 16:41:58 -04:00
Brian Coca
c77733e64e added docs for commonly used region parameter in some ec2 modules 2015-10-07 15:52:06 -04:00
Brian Coca
638bc14566 now deps is always a list 2015-10-07 15:41:11 -04:00
Brian Coca
dac3684fd1 changed task color to dark gray to keep it from being confused with ignore/skip 2015-10-07 12:12:35 -04:00
Brian Coca
c459dd4e18 Merge pull request #12663 from Juraci/task-path
Displays the absolute path of a given task when verbosity is above level 3
2015-10-07 12:09:21 -04:00
James Cammarata
dbae110f6f Merge pull request #12660 from apollo13/fix_galaxy_init
Show a nice error if the role name is missing.
2015-10-07 10:31:47 -04:00
Juraci
e52950a939 Displaying task_path on task start when verbosity is more than 3 2015-10-07 10:11:50 -03:00
Juraci
254d6be520 Adding get_path method to Task class 2015-10-07 10:10:57 -03:00
Florian Apolloner
354383874f Show a nice error if the role name is missing. 2015-10-07 11:37:23 +02:00
=
345ce424c6 Explictly set the version of strict mode to use for powershell modules. 2015-10-07 06:24:37 +01:00
James Cammarata
9e364c2eb5 Don't modify results in callbacks
Fixes #12654
2015-10-06 21:43:43 -04:00
James Cammarata
8107c4efc7 Fixing a bug in galaxy parsing of text spec file lines 2015-10-06 21:25:28 -04:00
James Cammarata
7a815b7296 Force connection to local when localhost is delegated to 2015-10-06 20:37:57 -04:00
Toshio Kuratomi
97e8d25eb4 Fix for encoding errors when a command returns non-utf8 encoded values 2015-10-06 14:10:25 -07:00
Toshio Kuratomi
4f6f2c21e8 range vs xrange doesn't matter here and six.moves.range isn't available in six-1.3.0 (rhel7) 2015-10-06 12:19:03 -07:00
James Cammarata
5ae74f7d38 Version bump for 2.0.0-0.3.beta1 2015-10-06 08:19:20 -04:00
James Cammarata
d9b79b1bbc Also template the role name when loading roles
Fixes #12602
2015-10-06 03:33:08 -04:00
James Cammarata
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
James Cammarata
fb822a4305 Merge pull request #12637 from rcleere/rekey_fix
Fix ansible-vault rekey
2015-10-05 23:33:32 -04:00
James Cammarata
3b8eaf6128 Cleaning up some ansible-galaxy stuff 2015-10-05 22:59:08 -04:00
Ryan Cleere
0400ab8c0f Fix ansible-vault rekey 2015-10-05 16:41:34 -05:00
James Cammarata
d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
James Cammarata
284bd118a0 Properly switch to the default transport when delegating from localhost 2015-10-05 16:32:58 -04:00
Brian Coca
6f88f79de9 removed dupe install code, now trap errors forom role.install 2015-10-05 13:04:12 -04:00
Brian Coca
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
Brian Coca
a3ed9fc131 updated to 'fixed' get_url so docs build again 2015-10-05 09:07:54 -04:00
Brian Coca
f3d0468726 updated submodule refs 2015-10-05 08:59:10 -04:00
James Cammarata
323012be2e Pop tags out of playbook include params
Fixes #12605
2015-10-05 08:41:34 -04:00
Toshio Kuratomi
10a4a4e986 Quote any file paths that we have to use with dd to copy.
This is because we pass the whole dd command string into the shell
that's running on the contained environment rather than running it
directly from python via subprocess without a shell.
2015-10-03 18:07:27 -07:00
Toshio Kuratomi
b83988d9fb Port libvirt_lxc connection plugin to v2 2015-10-03 17:42:49 -07:00