Commit graph

6135 commits

Author SHA1 Message Date
Brian Coca
66104191d1 fixed permissions check for ansible.log
fixes #13990
2016-01-26 11:22:52 -05:00
Brian Coca
46fde754af Merge pull request #14044 from skorochkin/devel
Adding support for scm-based role source urls (ansible-galaxy)
2016-01-26 10:41:05 -05:00
Tobias Wolf
5b293b56d6 Handle the key 'prepared' in the 'diff' result from modules
So far, when a 'diff' dict is returned with module results, it is
checked for 'before' and 'after' texts, which are processed in
_get_diff() by python difflib.  This generates the changes to display
when CLI users specify --diff.

However, some modules will generate changes that cannot easily be
expressed in a conventional diff. One example is the output of the
synchronize module, which presents changed files in a common log format
as in `rsync --itemize-changes`.

Add a check for a diff['prepared'] key, which can contain prepared diff text
from modules.
2016-01-26 09:29:37 +01:00
Toshio Kuratomi
c44110bc81 Update submodule refs to pick up the synchronize internal parameter 2016-01-25 19:57:28 -08:00
Toshio Kuratomi
a23a5d1b93 Merge pull request #13968 from ansible/synchronize-become-is-reversed
synchronize: First cut at not doing sudo on the control machine but on the remote machine instead.
2016-01-25 19:52:03 -08:00
Toshio Kuratomi
d0a062ffa3 python3 doesn't have raw explicit-unicode literals. Workaround it with a raw native string that we make unicode in py2. 2016-01-25 19:46:57 -08:00
Toshio Kuratomi
3cf59d30f7 For synchronize, fix sudo to execute on the remote end of the connection
* In 2.0.0.x become was reversed for synchronize. It was happening on
  the local machine instead of the remote machine. This restores the
  ansible-1.9.x behaviour of doing become on the remote machine.
  However, there's aspects of this that are hacky (no hackier than
  ansible-1.9 but not using 2.0 features).  The big problem is that it
  does not understand any become method except sudo.  I'm willing to use
  a partial fix now because we don't want people to get used to the
  reversed semantics in their playbooks.
* synchronize copying to the wrong host when inventory_hostname is
  localhost
* Fix problem with unicode arguments (first seen as a bug on synchronize)

Fixes #14041
Fixes #13825
2016-01-25 19:33:31 -08:00
Toshio Kuratomi
f4d68b8860 Transform tracebacks into unicode before printing
Fixes #14042
2016-01-25 19:18:59 -08:00
Brian Coca
c063803a91 raise AnsibleError as an 'expected' exception
fixes #14065
2016-01-25 22:20:55 -05:00
Brian Coca
9df0662408 simpler conditional 2016-01-25 22:01:48 -05:00
Jonathan Davila
041e1979c4 Boto3 error handle fix 2016-01-25 17:40:20 -05:00
Brian Coca
ac1d1673be adhoc now respects limit when listing hosts
also removed cruft about localhost as if used it is specified inline
fixes #13848
2016-01-25 17:39:01 -05:00
Jonathan Davila
f95652e7db Merge remote-tracking branch 'upstream/devel' into ec2_util_boto3 2016-01-25 17:35:39 -05:00
Brian Coca
87fe32319f ensure stdout callback alwasy is loaded first
it is now called for every event prior to any other callbacks
fixes #14114
2016-01-25 17:11:36 -05:00
Brian Coca
af88e34831 better error when host inventory script isnt dict 2016-01-25 16:32:09 -05:00
James Cammarata
a8ffa02134 Make sure blocks use their parents dependency chains
Fixes a bug inroduced in fb797a9 where included tasks in a role
were not being executed because the child blocks had no dep chain
set.
2016-01-25 09:02:44 -05:00
James Cammarata
2b02e8e2b4 Allow certain base attributes to be used as role params
Role definitions typically require params to be different from those
which are specified as FieldAttributes on the playbook classes used
for roles, however a certain subset should be allowed (typically those
used for connection stuff).

Fixes #14095
2016-01-24 23:04:50 -05:00
James Cammarata
46ede563dd Use templated handler name during callback
Fixes #14082
2016-01-23 09:25:50 -05:00
James Cammarata
fb797a9e77 Fixing role dependency chain creation
The dep chain for roles created during the compile step had bugs, in
which the dep chain was overwriten and the original tasks in the role
were not assigned a dep chain. This lead to problems in determining
whether roles had already run when in a "diamond" structure, and in
some cases roles were not correctly getting variables from parents.

Fixes #14046
2016-01-22 12:54:00 -05:00
James Cammarata
4651155942 Fix bug with any_errors_fatal where task was not available 2016-01-21 16:42:31 -05:00
James Cammarata
d02dee37a1 Disallow setting state on template tasks
Fixes #14056
2016-01-21 15:02:24 -05:00
Toshio Kuratomi
ecf867af6f Update submodule refs 2016-01-21 11:11:05 -08:00
Toshio Kuratomi
f594cc0a5b Merge pull request #13993 from towolf/avoid_json_to_unicode
Avoid recursively checking JSON inventory for Unicode
2016-01-21 08:41:16 -08:00
Tobias Wolf
d6ae9e2c29 Avoid recursively checking JSON inventory for Unicode
by moving to en-bloc unicode conversion to act on scripts stdout

Both python-json and simplejson always return unicode strings when using
their loads() method on unicode strings. This is true at least since
2009. This makes checking each substring unnecessary, because we do not
need to recursively check the strings contained in the inventory dict
later one-by-one

This commit makes parsing of large dynamic inventory at least 2 seconds
faster.

cf: https://github.com/towolf/ansible-large-inventory-testcase
2016-01-21 17:35:40 +01:00
Brian Coca
f26adcc7da avoid shredding empty files, also x/0
also cleaned up unused import and exception var
2016-01-21 10:54:56 -05:00
Sergii Korochkin
1325c21ca0 Adding support for scm-based role source urls (incl. integration test to cover it) 2016-01-21 14:00:29 +02:00
James Cammarata
627dec716b Template the run_once value in the linear strategy as we use it there
This is pre-post_validation, so we have to template it on the fly
as we use it to determine if we bypass the host loop.

Fixes #11876
2016-01-20 20:54:12 -05:00
James Cammarata
365c5b23ce Re-add cache clearing call to Inventory init
This prevents a bug where the existing cache outside of the class
is not cleared when creating a new Inventory object. This only really
affects people using the API directly right now, but wanted to fix it
to prevent weird errors from popping up.
2016-01-20 20:54:12 -05:00
Brian Coca
c2ac1507ea corrected host/group match in inventory_hostnames
now the lookup works when using ! and & operators
fixes #13997
2016-01-20 18:32:39 -05:00
James Cammarata
9b05a670c7 Merge pull request #14031 from selivan/devel
plugins/strategy: added significant details to parser error message.
2016-01-20 15:49:38 -05:00
James Cammarata
54cde0d082 Standardize removal of BECOME-SUCCESS method and use it for async too
Fixes #13965
Fixes #13971
2016-01-20 15:27:28 -05:00
Toshio Kuratomi
61009604e3 Update submodules to bring in yum fix 2016-01-20 12:18:52 -08:00
Toshio Kuratomi
d97d28ecb0 Merge pull request #14025 from ansible/run_command-env-rework
rework run_command's env setting to not change os.environ for the res…
2016-01-20 12:13:43 -08:00
Selivanov Pavel
3201f5d90e plugins/strategy: added significant details to parser error message.
See discussion at
https://github.com/ansible/ansible/issues/13753
2016-01-20 23:12:26 +03:00
Toshio Kuratomi
a68d90a71a rework run_command's env setting to not change os.environ for the rest of the module.
New param to run_command to modify the environment for just this invocation.
Documentation and comment adjustments.
2016-01-20 12:03:32 -08:00
Matt Martz
d49b11e996 Only use os.path.basename if get_file_content returned a value, and ensure that service_mgr has line endings stripped. Fixes #14026 2016-01-20 13:08:16 -06:00
Brian Coca
cc4506b451 Merge pull request #14006 from bcoca/always_shell_again
go back to always wrapping commands in shell
2016-01-20 13:17:34 -05:00
James Cammarata
ac89b0de7a Fix incorrect handling of any_errors_fatal in the linear strategy
Instead of bombing out of the strategy, we now properly mark hosts failed
so that the play iterator can handle block rescue/always properly.

Fixes #14024
2016-01-20 12:16:27 -05:00
James Cammarata
e3a6accc1d Forward conditionals onto included plays when conditional eval errors
When using a playbook-level include, we now catch any errors raised during
the conditional evaluation step and set a flag to indicate we need to pass
those conditionals on to the included play (most likely because they contain
inventory variables for evaluation).

Fixes #14003
2016-01-20 01:32:45 -05:00
James Cammarata
c8bbdd6b39 Don't assign both parent blocks and task includes to blocks
This causes problems when fetching parent attributes, as the include
was being skipped because the parent block would fetch the attribute
from the parent play first.

Fixes #13872
2016-01-19 22:47:07 -05:00
Brian Coca
c09c01a1f5 go back to defaulting wrapping commands in shell
this was taken out in an effort to default to the user's shell but creates issues as this is not known ahead of time
and its painful to set executable and shell_type for all servers, it should only be needed for those that restrict the user
to specific shells and when /bin/sh is not available. raw and command may still bypass this by explicitly passing None.
fixes #13882

still conditional
2016-01-19 22:09:17 -05:00
Peter Sprygada
981265ac84 adds provider argument to nxos shared module
The provider argument accepts the set of device common arguments as a
dict object.  Individual connection arguments can still be included and
take priority over the provider argument.  This update includes additions
to the nxos doc fragment
2016-01-19 19:02:41 -05:00
Peter Sprygada
9cba1a7c69 adds provider argument to ios shared module
New argument `provider` added to the ios shared module that provides
the ability to pass all of the common ios arguments as a dict.  This commit
includes some minor bugfixes and refactoring of names.   It also includes
udpates to the ios documentation fragment for the new argument
2016-01-19 19:00:52 -05:00
Peter Sprygada
e2ff26a5cf add provider argument to eos shared module
Adds a new argument `provider` to the eos shared module and updates the
eos doc fragment.  This commit includes some additional minor fixes and
code refactors for naming conventions.  The `provider` argument allows the
shared module arguments to be passed as a dict object instead of having
to pass each argument invididually.
2016-01-19 18:57:26 -05:00
James Cammarata
d07d974ad8 Revert "Properly look for parent become attribute"
This reverts commit 1b46a422aa.
2016-01-19 18:17:42 -05:00
Toshio Kuratomi
ca8261ed31 Don't tracback trying to retore settings
Can occur if we exit the timeout before the settings were changed
2016-01-19 14:09:22 -08:00
Peter Sprygada
0f2917fde3 add provider to iosxr shared module
This commit adds a new argument `provider` to the iosxr shared module that
allows common connection parameters to be passed as a dict object.  The
constraints on the args still applies.  This commit also updates the iosxr
doc fragment.
2016-01-19 14:51:06 -05:00
Peter Sprygada
7640eca368 adds provider argument to openswitch shared module
Adds new argument `provider` to the openswitch shared module.  The provider
argument can pass all openswitch connection arguments as a dict object.  This
update includes adding the provider argument to the openswitch doc fragment
2016-01-19 14:50:39 -05:00
Peter Sprygada
33d390fb58 adds provider argument to junos shared module
This commit adds a new argument `provider` to the junos shared module.  The
argument allows the set of common connection args to be passed to the
junos shared module.  This commit also updates the junos doc fragment
2016-01-19 14:50:01 -05:00
Peter Sprygada
5144ee226e adds private key file support to shell shared module
This commit provides an argument to provide a path to the private key
file.  This will allow paramiko to use the key file as opposed to only
username / password combinations for CLI connections.
2016-01-19 14:26:23 -05:00