Commit graph

7926 commits

Author SHA1 Message Date
John R Barker
9183bb6391 docs_fragments formatting and typo improvements (#17981) 2016-10-14 15:13:15 +01:00
Brian Coca
b169a61c20 toggle missing handler errors/warnings via config 2016-10-13 16:54:02 -04:00
Michael Scherer
f6bcd0f9a1 Add support for distribution_major_version on NetBSD. (#15885) 2016-10-13 16:25:55 -04:00
Peter Sprygada
936bca9fc6 fixes issue when checking if sessions are supported (#18013)
the supports_sessions() call was sending the command as a string instead
of a list which is required when transport is eapi.  This fixes that bug
2016-10-13 15:46:39 -04:00
Peter Sprygada
b1666020a9 adds additional exception handling in open() (#18003)
The open() method will now catch a socket.timeout exception and raise
a ShellError.
2016-10-13 15:13:00 -04:00
Peter Sprygada
bce31a11c2 minor fix for checking kwargs in get_config() (#18002)
The get_config() method was checking for a nonexistent kwarg that would
cause an exception.  This fixes that problem.
2016-10-13 15:12:49 -04:00
Brian J. Dowling
2be2f35373 Quick ansible-doc fix -- don't run pager if there was an error (no text) 2016-10-13 15:10:47 -04:00
Brian Coca
cdb5a222c5 restored 'results' filters
tests do not work the same, restoring old filters to keep backwards compat
tests now only implment the new normalized 'tense'
2016-10-13 13:21:40 -04:00
Peter Sprygada
65ea24f4bb adds log message for successful connection and disconnection (#17993)
The network module will now log a message when it connects to a remote host
successfully and specify the transport used.  It will also log a message
when the module discconnect() method is called.
2016-10-12 21:47:58 -04:00
Peter Sprygada
3badb212fb fixes issue in eos shared module for earlier versions of EOS (#17980)
Earlier versions of EOS that do not support config sessions would
create an exception.  This fix will now check if the device supports
sessions and if it doesn't, it will fall back to not using sessions
2016-10-12 20:16:20 -04:00
Toshio Kuratomi
33f5c25f41 Update submodule refs to pickup firewalld fix 2016-10-12 15:16:40 -07:00
Toshio Kuratomi
bf3d546d9a Only dispkay failure to use cryptography at a higher verbosity
Fixes #17982
2016-10-12 10:48:36 -07:00
Toshio Kuratomi
e5478a212f Update submodule refs 2016-10-11 16:13:11 -07:00
stephane
a32e48555d Correct delegated_host_name check
In fb50698da3 a check for delegated_host_name being defined was added. Make this
check safer as it breaks some playbooks.
2016-10-11 11:15:53 -07:00
Bruno Rocha
b06fb2022c Fix unbound method call for JSONEncoder (#17970)
* Fix unbound method call for JSONEncoder

The way it is currently it will lead to unbound method error

```python
In [1]: import json

In [2]: json.JSONEncoder.default('object_here')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-872fdacfda50> in <module>()
----> 1 json.JSONEncoder.default('object_here')

TypeError: unbound method default() must be called with JSONEncoder instance as first argument (got str instance instead)

```

But what is really wanted is to let the json module to raise the "is not serializable error" which demands a bounded instance of `JSONEncoder()`

```python
In [3]: json.JSONEncoder().default('object_here')
---------------------------------------------------------------------------
TypeError: 'object_here' is not JSON serializable 

```


BTW: I think it would try to call `.to_json` of object before raising as it is a common pattern.

* Calling JSONEncoder bounded `default` method using super()
2016-10-11 08:31:53 -07:00
Chris Houseknecht
77de83730d Add warnings when installing container type roles 2016-10-09 14:38:40 -04:00
Toshio Kuratomi
9f6bbf8c2f Switch get_config to use a single value_type parameter to determine type.
This is better API as the booleans could conflict with each other.

If the config value is a string, make sure to return it as a text string
rather than a byte string.
2016-10-07 18:57:39 -04:00
Ryan S. Brown
6444992afb Update submodule ref for devel 2016-10-07 17:18:10 -04:00
Pavlo Shchelokovskyy
aa1ec8af17 Make interprocess polling interval configurable (#16560)
As recently there was back-and-forth with this hardcoded value
(0.001 -> 0.01 -> 0.005), obviousely the optimal value for it depends on
Ansible usage scanario and is better to be configurable.

This patch adds a new config option in DEFAULT section,
`internal_poll_interval`, with default of 0.001 corresponding to the
value hardcoded in Ansible v2.1.
This config option is then used instead of hardcoded values where
needed.

Related GH issue: 14219
2016-10-06 14:30:20 -05:00
Toshio Kuratomi
9f9a960ceb Update submodules 2016-10-06 10:24:30 -07:00
Toshio Kuratomi
1efe782b46 Refactor parsing of CLI args so that we can modify them in the base class
Implement tag and skip_tag handling in the CLI() class.  Change tag and
skip_tag command line options to be accepted multiple times on the CLI
and add them together rather than overwrite.

* Make it configurable whether to merge or overwrite multiple --tags arguments
* Make the base CLI class an abstractbaseclass so we can implement
  functionality in parse() but still make subclasses implement it.
* Deprecate the overwrite feature of --tags with a message that the
  default will change in 2.4 and go away in 2.5.

* Add documentation for merge_multiple_cli_flags
* Fix galaxy search so its tags argument does not conflict with generic tags
* Unit tests and more integration tests for tags
2016-10-06 10:46:58 -04:00
Strahinja Kustudic
9962245b92 Moves 'statically included' messages to -vv verbosity (#17918) 2016-10-06 08:55:24 -05:00
James Cammarata
e26bce5221 Sleep briefly while waiting for pending results to reduce CPU churn 2016-10-06 08:50:17 -05:00
Peter Sprygada
087fb4265f adds new option to get_config to grab config with passwords (#17915)
In order for the config to be returned with vpn passwords, the get_config()
method now supports a keyword arg include=passwords to return the desired
configuration.  This replaces the show_command argument
2016-10-05 22:11:32 -04:00
Adrian Likins
41d6f5c635 out.split('\n') -> out.splitlines() (#17879)
foo.split('\n') is picky about the type of 'foo'.
if 'foo' is a bytes type, then foo.split('\n')
will fail on py3 with:

   TypeError: a bytes-like object is required, not 'str'

The foo.split('\n') change isn't strictly required
when run_command returns native str types, but it
is more idiomatic and conceptually also supports other
line endings.
2016-10-05 18:15:23 -04:00
James Cammarata
0a86ddc251 Move searching for roles in the cur basedir to last
Searching the DEFAULT_ROLES_PATH and the roles basedir should come
before this, and it has been a long standing oversight.

Fixes #17882
2016-10-05 01:25:19 -05:00
Mark Szymanski
3a6743fb54 Allowing hostcolor colours to be set 2016-10-04 20:31:10 -04:00
Brian Coca
d9d7e413a5 fixed storing of cwd 2016-10-04 14:24:45 -04:00
Toshio Kuratomi
23305540b4 Make ini parsing slightly more robust
Prior to this commit, the ini parser would fail if the inventory was
not 100% utf-8.  This commit makes this slightly more robust by
omitting full line comments from that requirement.

Fixes #17593
2016-10-04 11:24:50 -07:00
Brian Coca
74b7590211 better inventory error messages 2016-10-04 07:23:26 -07:00
James Cammarata
d09f57fb3a Check for substates in is_failed before checking main state failure
Fixes #17882
2016-10-04 01:21:07 -05:00
Toshio Kuratomi
08a58ae025 Fix for run_command tests now that it returns native strings 2016-10-03 18:45:28 -07:00
Brian Coca
125a8d3c65 no need for warnings in first_found 2016-10-03 20:23:33 -04:00
Brian Coca
54ce6a9b7a fix for include_role conflating vars/directives 2016-10-03 19:24:37 -04:00
Brian Coca
d4b2ea3ec8 include_role process name from options, not task 2016-10-03 18:29:50 -04:00
Toshio Kuratomi
965dcabed2 Update submodule refs for the command fix with new run_command 2016-10-03 15:06:52 -07:00
Adrian Likins
d0bdfc2abb Specify run_command decode error style as arg (#17886)
* Specify run_command decode error style as arg

Instead of getting the stdout/stderr text from
run_command, and then decoding to utf-8 with a
particular error scheme, use the 'errors' arg
to run_command so it does that itself.

* Use 'surrogate_or_replace' instead of 'replace'

For the text decoding error scheme in run_command calls.

* Let the local_facts run_command use default errors

* fix typo
2016-10-03 14:10:50 -07:00
Adrian Likins
2addc09050 cast/copy keys() to list to avoid py3 errors
In py3, dict.keys() is a view and not a copy of the
dicts keys, so attempting to delete items from the dict
while iterating over the keys results int

RuntimeError: dictionary changed size during iteration

Resolve by casting .keys() to a list() type.
2016-10-03 13:10:00 -07:00
Adrian Likins
9f673e0725 open anziballs payload 'wb' for py3 2016-10-03 13:06:50 -07:00
Toshio Kuratomi
ddd20627a4 Make run_command return native strings
This changes the return value on python3   Return value on python2 was
already byte strings (which is the native str type there.)
2016-10-03 11:48:37 -07:00
Chris Houseknecht
ab93d5aae4 Merge pull request #17873 from chouseknecht/fix_3964
Let docker-py decode pull response
2016-10-03 12:48:48 -04:00
James Cammarata
447ab0ab95 Bumping devel version to 2.3.0 2016-10-03 11:46:31 -05:00
Chris Houseknecht
fa7e572a96
Let docker-py decode pull response 2016-10-03 11:38:12 -04:00
Matt Davis
64d9de6b25 bump core submodule ref 2016-10-03 07:28:19 -07:00
Brian Coca
49ce0c8bac only change dir to playdir if local
fixes #17869
fixes #17770
2016-10-03 08:44:25 -04:00
Toshio Kuratomi
5bc3cb278c Remove unicode escape (#17866)
* Remove unicode-escape which is not present on python3

Alternative fix for #17305

* Enable the assemble test on python3

* Fix other problems with assemble on python3
2016-10-02 22:12:51 -07:00
Toshio Kuratomi
ddb3f91562 Update submodule refs 2016-10-02 21:54:21 -07:00
Guido Günther
14a9bd6a1c Add foreman callback plugin (#17141) 2016-10-03 00:12:12 -04:00
Toshio Kuratomi
f72b123584 On python3, subprocess needs another arg to pass extra file descriptors 2016-10-02 15:29:54 -07:00
Toshio Kuratomi
64c446d9c0 Normalize text and byte type in the ssh plugin helper method that builds up an ssh command (#17860)
Mostly cleanups to make the code more efficient, more pythonic, and obey
the unicode sandwich strategy more but also Fixes #17832
2016-10-02 14:55:55 -07:00
Peter Sprygada
b0cd624aef fixes issue with run_commands raising error (#17861)
The junos run_commands() method should raise an error when an RpcError is
returned but didn't when using display=text.  This fixes that error
2016-10-02 16:47:22 -04:00
Peter Sprygada
50c445c356 switches the kickstart arg from True to False for eos (#17858)
The kickstart kwarg should be set to False for eos based devices and
was set to True.  This change cleans up problems loading json output
from cli commands

All eos_command test cases are now passing successfully

fixes #17441
2016-10-02 15:03:03 -04:00
Peter Sprygada
512ef49c8a adds new exception for adding condition statements to Conditional (#17859)
When adding condition statements, the Conditional instance will now generate
an AddConditionError if is unable to map the condition to a function in the
instance
2016-10-02 14:47:58 -04:00
Matt Davis
a4e5187661 bump core submodule ref for windows async_wrapper bugfix 2016-10-02 08:55:44 -07:00
Matt Davis
aa0ad073b8 bugfixes to JSON junk filter, added unit/integration tests to exercise (#17834) 2016-10-02 08:03:42 -07:00
James Cammarata
657506cddd Ensure the "attempts" key is set in the final result for do/until loops
Fixes #17258
2016-10-02 01:06:13 -05:00
Senthil Kumar Ganesan
7e0074263d Remove the dellosX_template module (#17836) 2016-10-01 14:31:51 -04:00
Matt Davis
60b322e3ca bump core submodule ref for async_wrapper fixes 2016-09-30 16:17:45 -07:00
Indrajit Raychaudhuri
becb4765c3 Add homebrew in squash_actions list (#16966)
`homebrew`, like other package modules in the existing `squash_actions` list can
benefit from `with_items` loops optimization.
2016-09-30 18:07:09 -04:00
Brian Coca
dfff608ceb dzdo prompt fix
fixed tests
dzdo has 2 paths now, with and w/o password
fixes #17838
2016-09-30 17:58:19 -04:00
Brian Coca
6008fbd5cf fix fact gathering flag 2016-09-30 17:58:19 -04:00
Brian Coca
24e81ddd1c add ssh error message to failure 2016-09-30 17:58:19 -04:00
James Cammarata
e4ee9de3f4 Fixing parentage of include_role objects for param inheritance
Fixes #17686
2016-09-30 16:05:43 -05:00
Peter Sprygada
6be2f0bded fixes unicode conversation from junos get_config() method (#17841)
The junos config should convert the returning configuration to unicode
not str.  This fixes that issue.
2016-09-30 16:31:25 -04:00
Peter Sprygada
5b4f3b1eda adds better error handling when conditional fails (#17839)
When the conditional cannot extract a value from the result string,
an unhandled exception would be raised.  This fix now gracefully handles
the exception
2016-09-30 16:25:40 -04:00
Peter Sprygada
9faf56a345 fixes issue when calling save_config() and transport is nxapi (#17835)
An unhandled exeception is raised with using nxapi transport and setting
the save argument to true.  This fix will allow the configuration to be
saved regardless of the transport.

fixes ansible/ansible-modules-core#5094
2016-09-30 15:00:10 -04:00
Trond Hindenes
35fba5718d Bugfix: fixes new-alias bug when debugging powershell (#17816) 2016-09-30 09:46:06 -07:00
Makc
c6fa701ab1 jabber callback (#16981)
* jabber callback

* delete empty lines

* grammar fix

* fix: do not print error when jabber callback disabled

* change callback version 1 -> 2
2016-09-30 12:06:53 -04:00
Chris Houseknecht
e6eed3c3db Merge pull request #17818 from chouseknecht/devel
Parse role dependencies consistently
2016-09-30 10:03:32 -04:00
Chris Houseknecht
8300e67cbe Use new YAML syntax in role dependencies. 2016-09-29 21:57:12 -04:00
jctanner
fff161f2f6 Smart mode for sftp+scp (#17813)
If the sftp fails, roll over to scp by default. This saves users
from having to know about the scp_if_ssh method when sftp is broken
on the remote host.
2016-09-29 17:44:54 -04:00
Toshio Kuratomi
458990084e Update submodule refs 2016-09-28 23:10:23 -07:00
Peter Sprygada
c534f8f9fc fixes conditional processing with junos and xml data structures (#17801)
The conditional processing was failing due for two reasons:

1) The xml to json conversion string was not happening before the runner
   was processing the results
2) The Conditional instance was not parsing conditionals encoded with []

This fix address both issues.
2016-09-28 20:58:43 -04:00
cinerama70
fb50698da3 Graceful error handling when delegate_to host null (#17453) (#17783)
Currently, if the host specified in delegate_to for a task is null,
Ansible will crash with a stack trace. Add a check for this state
and handle the error appropriately.
2016-09-28 19:24:32 -04:00
Brian Coca
3c42651fc7 fixed typo 2016-09-28 18:34:19 -04:00
Gilles Gagniard
da5b0c39c9 fixes #16865 : we should properly determine connection type for delegated task first, before overriding remote user for local connections (#17723) 2016-09-28 18:33:40 -04:00
Peter Sprygada
9854644431 adds overwrite kwarg to load_config in junos (#17798)
The junos load_config() method supports operations of overwrite, replace
and merge.  This adds the missing overwrite keyword arg to load_config()
so that action in junos_template can be procesed correctly.
2016-09-28 14:36:53 -04:00
Toshio Kuratomi
17c0f52c96 Update submodules refs 2016-09-28 08:29:13 -07:00
Brian Coca
368497fd14 better handling of host lists (#17781)
* better handling of host lists

fixes #17762

* corrected message

* fixed extras space
2016-09-28 11:21:07 -04:00
Brian Coca
86ea21a73d ansible_play_batch (#17779)
* ansible_play_batch

* added version added
2016-09-28 10:32:19 -04:00
Peter Sprygada
605152e61b raises ValueError exception if conditional is not parsable (#17788)
The Conditional class now raises a ValueError with message if it cannot
correclty parse the passed in conditional.  This makes it easier to
detect issues in modules that specify conditionals.
2016-09-27 21:12:08 -04:00
Matt Clay
670536f685 Revert "Clear the plugin path cache when adding new directories" (#17785)
This reverts commit 5a57313dd7.
2016-09-27 16:17:35 -07:00
James Cammarata
5a57313dd7 Clear the plugin path cache when adding new directories 2016-09-27 14:48:35 -05:00
Matt Clay
dce94ec3c6 Update submodule refs. 2016-09-27 11:02:03 -07:00
Matt Davis
e7819609ce swallow errors during async polling (#17760)
also use connection reset on exceptions if available (eg, prevent reuse of "stuck" WinRM connections due to reboot/NIC bounce/etc)
2016-09-27 10:31:40 -07:00
Brian Coca
cf7822e201 remove bare vars and undefined from lookup lists (#17647)
https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
2016-09-27 12:32:04 -04:00
Brian Coca
3550f73837 removed deprecated first available file from tasks (#17643)
https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
2016-09-27 12:31:46 -04:00
Brian Coca
1b0b6b4c10 removed deprecated 'bare' templating environment (#17640)
https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
2016-09-27 12:31:14 -04:00
Brian Coca
943f4ebccf undefined var should fail 'label' setting (#17675) 2016-09-27 12:24:16 -04:00
Brian Coca
f63b8878fd fix delegate_facts (#17736)
code was misplaced when we changed result processing
also cleaned up import and clarified item/label
fixes #17582
2016-09-27 11:51:16 -04:00
Toshio Kuratomi
a4fed650e2 Update submodule refs 2016-09-27 08:35:44 -07:00
Toshio Kuratomi
eb33ed4219 Update submodule refs (especially to pick up the mount fixes) 2016-09-26 23:52:30 -07:00
Peter Sprygada
9694d60af5 fixes issue where arguments for regexp search() where transposed (#17764)
The arguments for the regex search() function were transposed in the
netcli match() method that caused conditionals to fail. Switched the
arguments to fixe the bug

fixes #17749
2016-09-26 19:29:57 -04:00
Michael Scherer
362b682f1c Add a umask argument to run_command
In order to avoid problem due to race conditions, it is
required to run umask when generating some sensitive files,
such as a TLS key.
2016-09-26 11:16:22 -04:00
Brian Coca
38b975800d removed unused code, added comment explaining
files is really a placeholder for common code for separate service modules, was copy of current service module and this seemed to confuse people so this update should clear that up
2016-09-26 10:27:56 -04:00
Senthil Kumar Ganesan
9d5dff5596 Update OS6 sublevels (#17735) 2016-09-24 09:27:38 -04:00
Toshio Kuratomi
bcebfab8e3 Update submodule refs 2016-09-23 14:51:14 -07:00
peter.jang
0d94d39689 fix for rsync protocol support (#16756) 2016-09-23 16:12:07 -04:00
Toshio Kuratomi
0f4c56a697 Update submodule refs to pick up mount fixes 2016-09-23 12:40:48 -07:00
Peter Sprygada
aa1e3ef2b5 fixes issue introduced with raw kwarg (#17728)
The raw kwarg was added to return raw output from devices with if the
attempt to convert to json failed.  The change was causing all json
output to be returned raw.  This fixes that issue.
2016-09-23 12:09:55 -04:00