Commit graph

8427 commits

Author SHA1 Message Date
Jasper Lievisse Adriaanse
4c0188a27b On OpenBSD, swap the values for distribution_version and distribution_release 2016-11-02 17:06:28 -07:00
Matt Clay
0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
2016-11-02 17:00:27 -07:00
Toshio Kuratomi
1ff92e28f9 Update submodule refs to get accurate archive doc 2016-11-02 12:54:26 -07:00
Patrick Uiterwijk
77af3a68de Fix adding the same trusted certificates multiple times (#18296)
If there is an intermittent network failure, we might be trying to reach
an URL multiple times. Without this patch, we would be re-adding the same
certificate to the OpenSSL default context multiple times.
Normally, this is no big issue, as OpenSSL will just silently ignore them,
after registering the error in its own error stack.
However, when python-cryptography initializes, it verifies that the current
error stack of the default OpenSSL context is empty, which it no longer is
due to us adding the certificates multiple times.
This results in cryptography throwing an Unknown OpenSSL Error with details:

OpenSSLErrorWithText(code=185057381L, lib=11, func=124, reason=101,
reason_text='error:0B07C065:x509 certificate routines:X509_STORE_add_cert:cert already in hash table'),

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-11-02 10:40:48 -07:00
Matt Clay
275d5f85ec Update submodule refs. 2016-11-02 09:59:10 -07:00
Samuel Boucher
911a602c79 Update syslog_json.py
Add SYSLOG_FACILITY environment variable to set syslog facility
2016-11-02 10:02:56 -04:00
Daniel
b7e6ace4ee Add timeout option for nxapi (#18074)
* Changes to be committed:
	modified:   lib/ansible/module_utils/nxos.py
    - added configurable timeout to module paramaters
	modified:   lib/ansible/utils/module_docs_fragments/nxos.py
    - added documentation for timeout

* Changes to be committed:
    modified:   ansible/module_utils/nxos.py
    - added timeout option for nxapi transport and added documentation
    - option works with CLI or NXAPI transport

*  Changes to be committed:
	modified:   lib/ansible/utils/module_docs_fragments/nxos.py
    - Changed per comments in PR 18074

*  Changes to be committed:
	modified:   lib/ansible/module_utils/nxos.py
    - added try/except block to test for timeout

* Changes to be committed:
modified:   lib/ansible/module_utils/nxos.py
 - tweaked timeout
2016-11-02 13:32:19 +00:00
jctanner
333f6d447b aix network facts: Separate out the uname call to reduce total calls (#18288)
* aix network facts: Separate out the uname call to reduce total calls
* Remove duplicate check

Fixes #11289
2016-11-01 19:34:26 -04:00
Jasper Lievisse Adriaanse
88970bcfb2 Implement basic DMI facts for OpenBSD 2016-11-01 13:50:02 -04:00
Adrian Likins
309f54b709 Fix 'vault rekey' with vault secret env var
if ANSIBLE_VAULT_PASSWORD_FILE is set, 'ansible-vault rekey myvault.yml'
will fail to prompt for the new vault password file, and will use
None.

Fix is to split out 'ask_vault_passwords' into 'ask_vault_passwords'
and 'ask_new_vault_passwords' to make the logic simpler. And then
make sure new_vault_pass is always set for 'rekey', and if not, then
call ask_new_vault_passwords() to set it.

ask_vault_passwords() would return values for vault_pass and new
vault_pass, and vault cli previously would not prompt for new_vault_pass
if there was a vault_pass set via a vault password file.

Fixes #18247
2016-11-01 13:07:48 -04:00
Toshio Kuratomi
557f46658c Update submodule refs 2016-11-01 09:39:32 -07:00
Daniel Menet
19fdb58948 fix iteritems for python 3 2016-11-01 09:38:03 -07:00
Michael Scherer
4c85a1fa05 Refactor code for VirtualFacts (#18122)
The populate method is cut and paste on every subclass,
so we should push it up, and add a default method that is overloaded
2016-11-01 10:07:50 -04:00
Brian Coca
d4ac0bdea9 display fixes
banner now adjusts to screen as does output
output now keeps at least one space to end of screen to allow for better reading.
2016-11-01 09:51:20 -04:00
Matt Clay
b42e42343c Update submodule refs. 2016-10-31 21:25:07 -07:00
jctanner
b494d55bde Cast input role version to string before comparing to available versions (#18269)
* Cast input role version to string before comparing to avaialble versions

Fixes #10262
2016-10-31 21:07:38 -04:00
Matt Clay
e753860cb2 Update submodule refs. 2016-10-31 17:16:53 -07:00
Matt Martz
cb1e3dab0d Add 'type' filter for display the underlying python type of a variable (#18242)
* Add 'type' filter for display the underlying python type of a variable

* Update playbooks_filters.rst

Minor copyedit.
2016-10-31 13:36:24 -07:00
James Tanner
6d9771bbf8 Move the check for playbook files above the password prompting.
Fixes #9904
2016-10-31 12:44:53 -04:00
Toshio Kuratomi
d7207b3910 Update submodule refs 2016-10-31 09:26:23 -07:00
René Moser
44bdc6fb79 cloudstack: implement diff support (#18254) 2016-10-30 17:05:24 +01:00
René Moser
01af859090 cloudstack: add support for defining some args as ENV vars (#17946)
These ENV vars are:
  - CLOUDSTACK_ZONE
  - CLOUDSTACK_DOMAIN
  - CLOUDSTACK_ACCOUNT
  - CLOUDSTACK_PROJECT

help to DRY on every task, args still have precedence.
2016-10-30 12:24:03 +01:00
Matt Clay
37580c7d70 Update submodule refs. 2016-10-29 23:28:23 -07:00
Sijis Aviles
b365f44fa1 Simplify surrogate check in to_text() (#18211)
* Simplify surrogate check in to_text()

* Simplify surrogateescape check even further
2016-10-29 09:12:02 -07:00
Nathaniel Case
4a067c3f50 Exception.message gone in 3.x (#18221)
* Exception.message gone in 3.x
2016-10-28 13:48:16 -04:00
Steve Kuznetsov
0bc35354ce Change v2_playbook_on_start logic to positively detect legacy plugins
In order to support legacy plugins, the following two method signatures
are allowed for `CallbackBase.v2_playbook_on_start`:

def v2_playbook_on_start(self):
def v2_playbook_on_start(self, playbook):

Previously, the logic to handle this divergence checked to see if the
callback plugin being called supported an argument named `playbook`
in its `v2_playbook_on_start` method. This was fragile in a few ways:
 - if a plugin author did not use the literal `playbook` to name their
   method argument, their plugin would not be called correctly
 - if a plugin author wrapped their `v2_playbook_on_start` method and
   by doing so changed the argspec to no longer expose an argument
   with that literal name, their plugin would not be called correctly

In order to continue to support both types of callback for backwards
compatibility while making the call more robust for plugin authors,
the logic can be reversed in order to have a positive check for the old
method signature instead of a positive check for the new one.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2016-10-28 10:05:58 -07:00
Matt Davis
916fc25088 bump submodule refs 2016-10-28 09:45:13 -07:00
Michael Scherer
6052c1294b Cleanup StringIO import for module_utils/shell.py 2016-10-28 08:00:57 -07:00
Toshio Kuratomi
4c06ddced6 Update submodule refs 2016-10-28 07:46:43 -07:00
Chris Houseknecht
dceb2a0393 Remove extra display statements and add docs (#18229)
* Add docs for ansible-galaxy import --role-name option.

* Add docs for ansible-galaxy init --container-enabled option.
2016-10-28 00:38:39 -04:00
Monty Taylor
bd9ca5ef28 Allow setting alternate_role_name for galaxy CLI (#17418)
When using the ansible-galaxy CLI to import roles, it's not possible to
specify an alternate_role_name, even though the REST API seems to allow
such a thing (at least on investigation of the interactions the web app
makes) That makes importing things like:
openstack/openstack-ansible-os_cloudkitty wind up with roles named
"openstack-ansible-os_cloudkitty" instead of "os_cloudkitty".

Also, the web ui is smart and imports
"openstack-infra/ansible-role-puppet" as openstack-infra.puppet ... but
the CLI imports it as openstack-infra.ansible-role-puppet. Add that
filtering as well.

Issue ansible/galaxy-issues:#185
2016-10-27 22:34:59 -04:00
Chris Houseknecht
d60bc492b6 Add --container-enabled option to ansible-galaxy init command. (#18157) 2016-10-27 22:16:22 -04:00
jasdeep-hundal
679da00236 Fix OpenSSH-related ssh process exit race
Mitigate the effects of observing the ssh process still running
after seeing an EOF on stdout when using OpenSSH with
ControlPersist, since it does not close the stderr file descriptor
in this case.
2016-10-27 15:47:24 -07:00
Matt Robinson
4ff8890ec1 Set ansible_os_family correctly under KDE neon
As neon is derived from Ubuntu, ansible_os_family should have the value
"Debian" instead of "Neon".  Add a test case for KDE neon and set
os_family correctly for it.
2016-10-27 20:28:38 +01:00
Andrew Gaffney
e6d9a45cd0 Fix service_mgr detection for OpenWrt 2016-10-27 14:09:26 -04:00
Toshio Kuratomi
fda933723c Add hint that python3 might be too old
This limitation of python-3.4 mkstemp() is the final reason we made
python-3.5 our minimum version.  Since we know about it, give a nice
error to the user with a hint that Python3.4 could be the issue.

Fixes #18160
2016-10-27 07:45:14 -07:00
jctanner
5a0621db55 iterate through task results only if the key is not at the root level (#18214)
Fixes https://github.com/ansible/ansible-modules-core/issues/5396
2016-10-27 09:43:49 -04:00
Brian Coca
680cade77a simplified the code by removing repeats
(cherry picked from commit 84380b0ee4029212fc1637c008e07bb9958305c3)
2016-10-26 20:49:55 -04:00
Rene Moser
3763283d01 tasks_queue_manager: fix fork calculation if serial in % 2016-10-26 15:21:31 -04:00
Toshio Kuratomi
56086f3b9e A few fixes for python3
* socket interfaces take bytes so convert text strings to bytes when
  using them.
* Use b64encode() instead of str.encode('base64')
2016-10-26 11:47:40 -07:00
Matt Davis
f8482e335c bump core submodule ref for win_shell/win_command fix 2016-10-25 17:22:18 -07:00
John R Barker
525b672c0c Docs fragment for common a10 options (#18163) 2016-10-25 16:03:25 +01:00
jctanner
5502da3cf8 copy: Use the local file's mode for the argument if not explicitly given. (#17780)
* Use the local file's mode to for the argument if not explicitly given.

Fixes https://github.com/ansible/ansible-modules-core/issues/1124

* Fix octal mode for py3

* Implement preserve instead of null

* Remove duplicate line

* Update comment

* Use stat module per toshia's suggestion
2016-10-24 23:57:50 -04:00
Will
1f30bc8a6f Fix lxd_container module fails if certificate already in trust store
When the client certificate is already stored, lxd returns a JSON error with message "Certificate already in trust store". This "error" will occur on every task run after the initial run. The cert should be in the trust store after the first run and this error message should really only be viewed as informational as it does not indicate a real problem.

Fixes:
ansible/ansible-modules-extras#2750
2016-10-24 20:40:04 -07:00
Matt Davis
d1e1898b0e fix version check to support >=rc5 2016-10-24 20:01:41 -07:00
Foxlik
8bb01d4c29 Fix #10865
Slightly better handling of http headers from http (CONNECT) proxy. Buffers up to 128KiB of headers and raises exception if this size is exceeded.

This could be optimized further, but for the time being it does the trick.
2016-10-24 18:18:38 -07:00
Toshio Kuratomi
188ae18b1c Add a new potential su prompt
Two parts to this change:
* Add a new string that requests password
* Add a new glyph that can be used to separate the prompt from the
  user's input as it seems it can use fullwidth colon rather than colon.

Fixes #17867
2016-10-24 16:55:54 -07:00
Thomas Quinot
236c923c25 Filter out internal magic and connection variables from facts returns
Fixes #15925
2016-10-24 17:27:43 -05:00
Michael Riss
c05bad9f74 Improved caching for urls
- When there is no file at the destination yet, we have no modification time for the `If-Modified-Since`-Header. In this case trust the cache to make the right decision to either serve a cached version or to refresh from origin. This should help with mass-deployment scenarios where you want to use a local cache to relieve your uplink.
- If you don't trust the cache to make the right decision you can still force it to refresh by providing the `force: yes` option.
2016-10-24 16:13:38 -04:00
Rene Moser
e69d26270f handler: notify a handler by name _and_ listen
Before we only allowed either notify by name or listen and name had precedence.
2016-10-24 10:59:05 -04:00
Toshio Kuratomi
ce4330d986 Update submodule refs 2016-10-24 07:21:29 -07:00
Michael Scherer
6885797b03 Add support for getting network facts on GNU Hurd
Since ifconfig/ip are not present on the system, and there is no /proc
to be parsed, the only way to get information is by looking at the
argument of the pfinet translator, the process in charge of network.

In turn, this is done with fsysopts on the appropriate path, who return
something like this:

    # fsysopts -L /servers/socket/inet
    /hurd/pfinet --interface=/dev/eth0 --address=192.168.122.130
    --netmask=255.255.255.0 --gateway=192.168.122.1 --address6=fe80::5254:12:ced/10
    --address6=fe80::5054:ff:fe12:ced/10 --gateway6=::

So to get the IP addresses, one has to parse that string and fill the appropriate
structure.

More information on the system and on limitation can be found on
- https://www.gnu.org/software/hurd/hurd/translator/pfinet.html
- https://www.gnu.org/software/hurd/hurd/translator/pfinet/implementation.html
- https://www.debian.org/ports/hurd/hurd-install
2016-10-24 09:45:22 -04:00
Michael Scherer
f4593ecac7 Add support for getting hardware facts on GNU Hurd (#18152)
* Fallback to /proc/mounts if /etc/mtab do not exist

On modern system, the file is just a compatibility symlink, and
some system (like GNU Hurd) do not have it, but provides /proc/mounts

* Add support for uptime, memory and mount facts on GNU Hurd
2016-10-24 09:44:52 -04:00
Matt Davis
2708ef99b8 bump core submodule ref for async fix 2016-10-24 00:00:24 -07:00
Toshio Kuratomi
3098cc2eb9 Update submodule refs 2016-10-23 16:55:43 -07:00
Toshio Kuratomi
dcbd64b481 Update submodule refs 2016-10-23 14:47:16 -07:00
Michael Scherer
6a76a9299d Fix 18151, by converting float to int 2016-10-23 14:00:51 -07:00
Adrian Likins
c0331d50dc Remove callback.CallbackBase._copy_result_exclude
Nothing seems to use this now.

Was added originally added in2d11cfab92f9d26448461b4bc81f466d1910a15e
but the code that used it was removed in
e02b98274b
2016-10-23 13:36:20 +02:00
stephane
77868a4104 Set Suse family for openSUSE Tumbleweed & Leap
On openSUSE Tumbleweed, lsb-release -a currently reports
the distributor ID as "openSUSE Tumbleweed". On openSUSE
Leap, the distributor ID is "SUSE LINUX".

Add them to the OS_FAMILY dict as Suse family systems.

Also add an entry to TESTSETS in test_distribution_version.py
for openSUSE Tumbleweed.
2016-10-23 02:04:28 +02:00
Matt Robinson
692bfa872a Make bcrypt + passlib work in password_hash filter
If hashtype for the password_hash filter is 'blowfish' and passlib is
available, hashing fails as the hash function for this is named 'bcrypt'
(and not 'blowfish_crypt').  Special case this so that the correct
function is called.
2016-10-23 01:46:05 +02:00
Toshio Kuratomi
def260b5d1 Update submodule refs to pick up latest py3 fixes (and git dep yaml fix) 2016-10-21 09:01:35 -07:00
Brian Coca
aa5938bf8e updated submodule ref 2016-10-21 11:19:46 -04:00
Ssawa
8e47b9bc70 Handle 'smart' scp_if_ssh option for fetch (#18125) 2016-10-21 09:59:56 -04:00
Toshio Kuratomi
6d9f780937 Now that we convert salt inside of do_encryptas needed, keep salt as text type until then. 2016-10-20 22:49:30 -07:00
Thilo Uttendorfer
cf0da0948d Fix uninitialized variable in deserialize method (#18037)
The bug was introduced with commit 06d4f4ad0e.
Added a simple test.
2016-10-20 22:54:16 -04:00
Dag Wieers
cd784cd345 Remove unnecessary warnings (#18121) 2016-10-20 22:49:49 -04:00
Michael Scherer
492da6ce71 Add support for NetBSD network fact (#18113)
Like hostname, it use the same interface as FreeBSD so
we bascailly reuse the same code. Only tested on NetBSD 7.
2016-10-20 17:50:22 -04:00
Toshio Kuratomi
9a5be38a22 Update submodule refs 2016-10-20 14:04:35 -07:00
Michael Scherer
578da9a615 Enable test for lookups on python 3
Since passlib algo sometime takes a bytes, and sometime
not, depending on a internal variable, we have to convert
bnased on it, or it fail with "TypeError: salt must be bytes,
not str" (or unicode instead of bytes)

However, that's not great to use internal structure for that.
2016-10-20 13:22:59 -07:00
Brian Coca
fbe0e6c9a2 improved error msg 2016-10-20 16:02:06 -04:00
Brian Coca
ea428e716d role now fails if specified file not found
fixes https://github.com/ansible/ansible-modules-core/issues/5166
2016-10-20 14:39:54 -04:00
Brian Coca
432633e4c1 fix for check_mode/async interaction
fixes #18110
2016-10-20 14:38:36 -04:00
Toshio Kuratomi
1d3db8ec5b iUpdate submodule refs 2016-10-20 10:29:57 -07:00
Michael Scherer
4549604cc7 Use six.move for module in module_utils/facts.py 2016-10-19 21:32:28 -07:00
Ryan S. Brown
a4660766f7 Update core submodule ref 2016-10-19 19:07:29 -04:00
Toshio Kuratomi
25e25127b9 Update submodule refs 2016-10-19 08:59:59 -07:00
Toshio Kuratomi
5037dc4e69 Make the default Ansible_managed string static so it doesn't interfere with idempotency 2016-10-18 16:19:17 -04:00
Brian Coca
99220a5f6c properly propagate loop vars
fixes #17966
2016-10-18 15:27:16 -04:00
Toshio Kuratomi
001e2b52e0 Update submodule ref for git fix 2016-10-18 11:54:45 -07:00
Brian Coca
01b75f966b fix include_role dynamic path
fixes #17966
2016-10-18 13:27:38 -04:00
Brian Coca
38d0f77a0f include_role now allows duplicates by default
setting is overridable by user
2016-10-18 11:14:10 -04:00
Toshio Kuratomi
ea479001f0 Update submodule ref 2016-10-18 07:22:31 -07:00
Toshio Kuratomi
60acfd1e87 Fix ansible-pull on python3
On python3, we can't write bytes directly to sys.stdout.
2016-10-17 16:31:08 -07:00
Toshio Kuratomi
2b105ec7ab Update submodule refs 2016-10-17 14:21:31 -07:00
James Cammarata
5be2a3a9e0 Break out of linear strategy if all hosts are failed and the result is not OK
Fixes #18021
2016-10-17 16:00:04 -05:00
Thilo Uttendorfer
5ece97ae5b Fix call of wrong super class
Added a basic test
2016-10-17 14:53:03 -04:00
Aaron Bieber
3fc1b4da53 Remove -b option from pbrun.
The -b option reads as follows:
` The target job is directed to ignore hangup signals. This is particularly
useful for running the target program in the background.`

If needed, '-b' can be added to become_flags

Squashed commit of the following:

commit f2c9f5c011ae8be610301d597a34bfba1a391e08
Author: Aaron Bieber <aaron@bolddaemon.com>
Date:   Mon Oct 17 10:58:14 2016 -0600

    remove pbrun flags

commit f402679ac177c931ad64bd13306f62512a14fcd6
Author: Aaron Bieber <aaron@bolddaemon.com>
Date:   Fri Oct 14 15:29:29 2016 -0600

    use Password: vs assword: for matching pbrun prompt

commit cd2e90cb65854c4cc5dd8773404e520d40f82765
Author: Aaron Bieber <aaron@bolddaemon.com>
Date:   Fri Oct 14 15:28:58 2016 -0600

    move -b to pbrun_flags
2016-10-17 14:40:11 -04:00
Andrew Gaffney
194c9c41eb Fix search path for relative paths in roles (fixes #17877)
(cherry picked from commit 72f0aaf606)
2016-10-17 11:21:46 -04:00
Brian Coca
9bdde13126 fixes to ansible_search_path
now gets basedir (no need to frontload as dwim already does that)
added comment about basedir to search_path usage to avoid dupes
2016-10-17 11:21:46 -04:00
Brian Coca
7d9d009189 avoid errors when dynamic role 2016-10-17 11:21:46 -04:00
Toshio Kuratomi
4ce0cf57b6 Update submodule refs 2016-10-17 08:15:33 -07:00
Robin Roth
3922328954 Allow unicode inventory filename
Fixes #17932
2016-10-15 16:54:51 -07:00
Bill Nottingham
77e7ae6838 Change <support@ansible.com> - it's being retired. 2016-10-15 16:42:13 -07:00
Toshio Kuratomi
f24c10c32b Fixes to handle non-ascii become passwords
Fixes for non-ascii passwords on
* both python2 and python3,
* local and paramiko_ssh (ssh tested working with these changes)
* sudo and su

Fixes #16557
2016-10-15 16:25:19 -07:00
Toshio Kuratomi
efc5dac52c Fix become password using non-ascii for local connection
Fixes #18029
2016-10-15 11:26:17 -07:00
Toshio Kuratomi
e9e7967dd0 Update extras submodule ref to pull in misc's py3 fixes 2016-10-15 09:17:49 -07:00
Toshio Kuratomi
9a49506677 Update submodule refs 2016-10-15 08:24:33 -07:00
James Cammarata
0d5206f90c Don't mark parent role complete for nested include_role calls
The PlayIterator was written without nested roles in mind, but since
include_role can nest them we need to check to see if we've moved into
a new role which is a child via nesting.

Fixes #18026
2016-10-14 14:28:40 -05:00
Matt Clay
7e2fc88218 Fix docs fragment typo. 2016-10-14 09:50:15 -07:00
Brian Coca
ff1e52184f Better error for bad role def 2016-10-14 11:38:09 -04:00
James Cammarata
6bdcb3a392 Make sure free strategy is returning proper TQM constants
Fixes #18023
2016-10-14 09:23:35 -05:00
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
j0hnsmith
4650d8910e Feature/add ansible play hosts all (#17498)
* refactor ignore_limits_and_restrictions

into ignore_limits and ignore_limitations

* add ansible_play_hosts_all

* update docs re ansible_play_hosts_all

* only use play.hosts when is has a value

* replace ansible_play_hosts with ansible_play_hosts_all

* remove unnecessary var
2016-09-23 11:17:46 -04:00
Brian Coca
52bf021904 clarified omit intended usage
fixes #13986
2016-09-23 10:19:36 -04:00
nitzmahone
f82c693181 bump extras submodule ref 2016-09-22 20:07:20 -07:00
Peter Sprygada
361f3999ea fixes issue where junos shared module was ignoring ssh_keyfile (#17712)
This fixes a problem with the Netconf transport in which the ssh keyfile
wasn't being used if it was defined.  The ref issue is filed against 2.1.1
but have been unable to replicate the problem in that version

ref: ansible/ansible-modules-core#4966
2016-09-22 19:52:42 -04:00
James Cammarata
6666d13654 Add max_passes to the debug strategy override of _process_pending_results
Fixes #17520
2016-09-22 10:49:30 -05:00
jctanner
a2547db5b5 ini lookup: add 'type' to the list of known arguments (#17707)
Fixes #16556
2016-09-22 11:32:14 -04:00
Pascal Grange
8b08a28c89 fixes issue #13981: unsafe_writes block appeared too late in the atom… (#17405)
* fixes issue #13981: unsafe_writes block appeared too late in the atomic_move
workflow. This led to errno.EBUSY to not be managed in the context of
issue #!#981

* Reduce changes to fix #13981

* Abstract the unsafe_writes fallback into a helper method.
Explicitly try/except os.rename part of the code and call this helper method.
If the code fails in shutil.copy2 or shutil.move this should not be related to issue #13981
since they write to b_tmp_dest_name.
(as suggested by @abadger)

* Check if unsafe_writes in the caller, not in _unsafe_writes.
That way the function call reads as "Do an unsafe write"
and not as "I think we should do an unsafe_write.
2016-09-22 11:31:35 -04:00
Peter Sprygada
839f908a14 fixes mode on module_utils/dellos9.py (#17682) 2016-09-22 10:42:57 -04:00
Toshio Kuratomi
dde7c11713 Update submodule refs 2016-09-21 20:42:22 -07:00
Toshio Kuratomi
8aa8e07d13 Remove _load_hosts() from Play initialization as it's no longer needed and it breaks using extra_vars defining a list for hosts (#17699)
Thanks to @jimi-c for the solution

Fixes #16583
2016-09-21 17:25:54 -07:00
James Cammarata
c9d3d2b9a0 Allow for empty source in dwim_path_relative_stack
Fixes #17192
2016-09-21 16:16:14 -05:00
James Cammarata
23651b657e Create a raw lookup for hostvars that does not template the data
When using hostvars to get extra connection-specific vars for connection
plugins, use this raw lookup to avoid prematurely templating all of the
hostvar data (triggering unnecessary lookups).

Fixes #17024
2016-09-21 13:16:08 -05:00
Ondra Machacek
04165fb6c0 Add oVirt support to ansible/module_utils module (#17364)
* Add oVirt utility module

This patch add oVirt utility module, which contains helper functions,
for oVirt modules and also shared documentation fragment for oVirt.

* Adjust to Python 2.4

* Fixups

* Add support for poll interval and fixes
2016-09-21 12:41:36 -04:00
Gabriele
cfd880dab8 Adding raw check to nxos.py (#17659) 2016-09-21 05:35:56 -04:00
Peter Sprygada
765a76885b fixes issue where config sessions where left behind (#17673)
When using the Cli transport, if the session hung on a command and the
socket timed out, the config session would be left behind.  This change
will allow the shell to try to get control back and remove the config
session, assuming the channel is still open.

fixes ansible/ansible-modules-core#4945
2016-09-20 16:30:09 -04:00
Peter Sprygada
2a908b832c fixes commit confirm check in junos shared module (#17663)
The module didn't perform a commit confirm check which would cause
checking commits to be non idempotent.  This change will fix that problem.
2016-09-20 16:12:08 -04:00
Matt Clay
24c9e047c3 Remove test-docs from module search ignore list. (#17670) 2016-09-20 15:38:46 -04:00
Matt Clay
08e964a9c5 Update submodule refs. 2016-09-20 12:24:36 -07:00
Brian Coca
1e4e188318 changed missing file error to warning for lookups (#16800)
* changed missing file error to warning for lookups

* changed plugins that expected exception

warning will still be displayed, they now work with None value
2016-09-20 15:05:11 -04:00
Toshio Kuratomi
55cbe257cc Update submodule refs to pick up pip fixes 2016-09-20 11:03:28 -07:00
James Cammarata
4dc2bf4815 Take ITERATING_ALWAYS into account when setting failed state in PlayIterator
Fixes #15963
2016-09-20 11:11:52 -05:00
Timothy Appnel
1975a545bd Implements verbose always to assert action plugin module (#17654) 2016-09-20 10:52:21 -05:00
Toshio Kuratomi
a683256342 Update core submodule ref for pip fix 2016-09-20 08:05:43 -07:00
James Cammarata
1b54d3b6dc Merge branch 'threaded_receiver' into devel 2016-09-20 09:18:26 -05:00
Toshio Kuratomi
2f6ab44c76 Update sumodule refs 2016-09-20 07:10:17 -07:00
Peter Sprygada
547cea556f remove old imports from junos shared module (#17655)
this cleans up the old import mechanisms in the junos shared module
2016-09-19 23:14:17 -04:00
Peter Sprygada
433a0e1e40 allow netcfg to pass kwargs from __call__ to configure() (#17653)
This minor fix allows kwargs to pass from Config __call__ to the underlying
transport instance.
2016-09-19 22:27:31 -04:00
Peter Sprygada
6fc9ffd28e clean up junos shared module (#17652)
This cleans up the junos module removing some unneeded commands and fixing
method signature with unneeded **kwargs
2016-09-19 22:27:23 -04:00
Peter Sprygada
662008115b Merge pull request #17651 from skg-net/bugfix
Fix to handle the prompt on saving startup config
2016-09-19 21:15:44 -04:00
Matt Clay
5f72bae3b0 Update submodule refs. 2016-09-19 17:00:31 -07:00
Matt Clay
ded45fb535 Update submodule refs. 2016-09-19 16:35:05 -07:00
Senthil Kumar Ganesan
081730851c Fix to handle the prompt on saving startup config 2016-09-19 14:41:30 -07:00
Matt Clay
42a2875b83 Update submodule refs. 2016-09-19 13:52:51 -07:00
James Cammarata
1d2e1a5648 Do not set run_once for meta noop tasks
Fixes #17581
2016-09-19 14:27:02 -05:00
Toshio Kuratomi
e3451be457 Update submodule refs 2016-09-19 11:53:32 -07:00
Peter Sprygada
b38181116b Merge pull request #17638 from privateip/fix-netcli
fixes issue where netcli would cause exception with an invalid conditional
2016-09-19 14:46:13 -04:00
Toshio Kuratomi
5e9a8d9202 Fix password lookup py3 plus alikins unittest additions refactoring (#17626)
* Improve unit testing of 'password' lookup

The tests showed some UnicodeErrors for the
cases where the 'chars' param include unicode,
causing the 'getattr(string, c, c)' to fail.
So the candidate char generation code try/excepts
UnicodeErrors there now.

Some refactoring of the password.py module to make
it easier to test, and some new tests that cover more
of the password and salt generation.

* More refactoring and fixes.

* manual merge of text enc fixes from pr17475

* moving methods to module scope

* more refactoring

* A few more text encoding fixes/merges

* remove now unused code

* Add test cases and data for _gen_candidate_chars

* more test coverage for password lookup

* wip

* More text encoding fixes and test coverage

* cleanups

* reenable text_type assert

* Remove unneeded conditional in _random_password

* Add docstring for _gen_candidate_chars

* remove redundant to_text and list comphenesion

* Move set of 'chars' default in _random_password

on py2, C.DEFAULT_PASSWORD_CHARS is a regular str
type, so the assert here fails. Move setting the
default into the method and to_text(DEFAULT_PASSWORD_CHARS)
if it's needed.

* combine _random_password and _gen_password

* s/_create_password_file/_create_password_file_dir

* native strings for exception msgs

* move password to_text to _read_password_file

* move to_bytes(content) to _write_password_file

* add more test assertions about genned pw's

* Some cleanups to alikins and abadger's password lookup refactoring:

* Make DEFAULT_PASSWORD_CHARS into a text string in constants.py
  - Move this into the nonconfigurable section of constants.
* Make utils.encrypt.do_encrypt() return a text string because all the
  hashes in passlib should be returning ascii-only strings and they are
  text strings in python3.
* Make the split up of functions more sane:
   - Don't split such that conditionals have to occur in two separate functions.
   - Don't go overboard: Good to split file system manipulation from parsing
     but we don't need to do every file manipulation in a separate
     function.
  - Don't split so that creation of the password store happens in two
    parts.
  - Don't split in such a way that no decisions are made in run.
* Organize functions by when it gets called from run().
* Run all potential characters through the gen_candidate_chars function
  because it does both normalization and validation.
* docstrings for functions
* Change when we store salt slightly.  Store it whenever it was already
  present in the file as well as when encrypt is requested.  This will
  head of potential idempotence bugs where a user has two playbook tasks
  using the same password and in one they need it encrypted but in the
  other they need it plaintext.
* Reorganize tests to follow the order of the functions so it's easier
  to figure out if/where a function has been tested.
* Add tests for the functions that read and write the password file.
* Add tests of run() when the password has already been created.
* Test coverage currently at 100%
2016-09-19 11:37:57 -07:00
Peter Sprygada
1a8ad2a20f fixes issue where netcli would cause exception with an invalid conditional
The Conditional instance will cause a stack trace if the provided conditional
does not map properly to the response.  This fixes that issue so that the
Conditional instance will now raise a FailedConditionalError with the
conditional that caused the failure.

Modules *_command modules (and any other modules that create an instance
of Conditional) should be updated to catch the FailedConditionalError
exception.
2016-09-19 14:14:43 -04:00
Brian Coca
a87a239124 draft of return common fields
(cherry picked from commit da2da568a051d51edd8c25a4d324089f8bd616eb)
2016-09-19 12:35:59 -04:00
fallencliff
06d46a1ecc update facts.py for aix (#17539)
* update facts.py for aix

add product_serial ,lpar_info,product_name and pv/vg info into facts

10.223.219.10 | SUCCESS => {
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [
            "77.77.77.1", 
            "10.223.219.10"
        ], 
        "ansible_all_ipv6_addresses": [
            "::1%1/0"
        ], 
        "ansible_architecture": "chrp", 
        "ansible_date_time": {
            "date": "2016-09-13", 
            "day": "13", 
            "epoch": "1473760269", 
            "hour": "17", 
            "iso8601": "2016-09-13T09:51:09Z", 
            "iso8601_basic": "20160913T175109568670", 
            "iso8601_basic_short": "20160913T175109", 
            "iso8601_micro": "2016-09-13T09:51:09.569251Z", 
            "minute": "51", 
            "month": "09", 
            "second": "09", 
            "time": "17:51:09", 
            "tz": "BEIST", 
            "tz_offset": "BEIST", 
            "weekday": "Tuesday", 
            "weekday_number": "2", 
            "weeknumber": "37", 
            "year": "2016"
        }, 
        "ansible_default_ipv4": {
            "address": "10.223.219.10", 
            "broadcast": "10.223.219.127", 
            "device": "en3", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "gateway": "10.223.219.1", 
            "interface": "en3", 
            "macaddress": "00:11:25:be:4b:75", 
            "mtu": "1400", 
            "netmask": "255.255.255.128", 
            "network": "10.223.219.0", 
            "type": "unknown"
        }, 
        "ansible_default_ipv6": {}, 
        "ansible_distribution": "AIX", 
        "ansible_distribution_release": "1", 
        "ansible_distribution_version": "6", 
        "ansible_dns": {}, 
        "ansible_domain": "", 
        "ansible_en0": {
            "device": "en0", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "77.77.77.1", 
                    "broadcast": "77.77.77.127", 
                    "netmask": "255.255.255.128", 
                    "network": "77.77.77.0"
                }
            ], 
            "ipv6": [], 
            "macaddress": "00:14:5e:b8:cd:a6", 
            "mtu": "1500", 
            "type": "unknown"
        }, 
        "ansible_en3": {
            "device": "en3", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "10.223.219.10", 
                    "broadcast": "10.223.219.127", 
                    "netmask": "255.255.255.128", 
                    "network": "10.223.219.0"
                }
            ], 
            "ipv6": [], 
            "macaddress": "00:11:25:be:4b:75", 
            "mtu": "1400", 
            "type": "unknown"
        }, 
        "ansible_env": {
            "AUTHSTATE": "compat", 
            "CLCMD_PASSTHRU": "1", 
            "HOME": "/home/yd_hzj", 
            "LANG": "C", 
            "LC_ALL": "C", 
            "LC_MESSAGES": "C", 
            "LC__FASTMSG": "true", 
            "LOCPATH": "/usr/lib/nls/loc", 
            "LOGIN": "yd_hzj", 
            "LOGNAME": "yd_hzj", 
            "MAIL": "/var/spool/mail/yd_hzj", 
            "NLSPATH": "/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat", 
            "ODMDIR": "/etc/objrepos", 
            "PATH": "/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin", 
            "PWD": "/home/yd_hzj", 
            "PYTHONPATH": "", 
            "SHELL": "/usr/bin/ksh", 
            "SSH_CLIENT": "10.223.172.41 33369 22", 
            "SSH_CONNECTION": "10.223.172.41 33369 10.223.219.10 22", 
            "SSH_TTY": "/dev/pts/12", 
            "TERM": "vt100", 
            "TZ": "BEIST-8", 
            "USER": "yd_hzj", 
            "_": "/usr/bin/python"
        }, 
        "ansible_fips": false, 
        "ansible_firmware_version": "SF240_358", 
        "ansible_fqdn": "test1", 
        "ansible_gather_subset": [
            "hardware", 
            "network", 
            "virtual"
        ], 
        "ansible_hostname": "test1", 
        "ansible_interfaces": [
            "en0", 
            "lo0", 
            "en3"
        ], 
        "ansible_kernel": "1", 
        "ansible_lo0": {
            "device": "lo0", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "LOOPBACK", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "127.0.0.1", 
                    "broadcast": "127.255.255.255", 
                    "netmask": "255.0.0.0", 
                    "network": "127.0.0.0"
                }
            ], 
            "ipv6": [
                {
                    "address": "::1%1/0"
                }
            ], 
            "macaddress": "unknown", 
            "mtu": "16896", 
            "type": "unknown"
        }, 
        "ansible_lpar_info": "1 test1", 
        "ansible_machine": "00CE5FA34C00", 
        "ansible_memfree_mb": 9992, 
        "ansible_memtotal_mb": 98304, 
        "ansible_nodename": "test1", 
        "ansible_os_family": "AIX", 
        "ansible_pkg_mgr": "svr4pkg", 
        "ansible_processor": "PowerPC_POWER5", 
        "ansible_processor_cores": 2, 
        "ansible_processor_count": 12, 
        "ansible_product_name": "IBM,9119-595", 
        "ansible_product_serial": "02E5FA3", 
        "ansible_python": {
            "executable": "/usr/bin/python", 
            "has_sslcontext": false, 
            "type": "CPython", 
            "version": {
                "major": 2, 
                "micro": 5, 
                "minor": 7, 
                "releaselevel": "final", 
                "serial": 0
            }, 
            "version_info": [
                2, 
                7, 
                5, 
                "final", 
                0
            ]
        }, 
        "ansible_python_version": "2.7.5", 
        "ansible_selinux": false, 
        "ansible_service_mgr": "src", 
        "ansible_ssh_host_key_dsa_public": "AAAAE23Nzav1hVVTNNoYvp7eokKbwY", 
        "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYvp7eokKbwY=", 
        "ansible_ssh_host_key_rsa_public": "AAAAB3Nzav1hVVTNfKiM4W1j9mcw==", 
        "ansible_swapfree_mb": 16558, 
        "ansible_swaptotal_mb": 16896, 
        "ansible_system": "AIX", 
        "ansible_user_dir": "/home/yd_hzj", 
        "ansible_user_gecos": "", 
        "ansible_user_gid": 7, 
        "ansible_user_id": "yd_hzj", 
        "ansible_user_shell": "/usr/bin/ksh", 
        "ansible_user_uid": 263, 
        "ansible_userspace_bits": "32", 
        "ansible_vgs": {
            "realsyncvg": [
                {
                    "free_pps": "6", 
                    "pp_size": "128 megabyte(s)", 
                    "pv_name": "hdisk74", 
                    "pv_state": "active", 
                    "total_pps": "1999"
                }
            ], 
            "rootvg": [
                {
                    "free_pps": "0", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk0", 
                    "pv_state": "active", 
                    "total_pps": "546"
                }, 
                {
                    "free_pps": "113", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk1", 
                    "pv_state": "active", 
                    "total_pps": "546"
                }
            ], 
            "testvg": [
                {
                    "free_pps": "838", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk105", 
                    "pv_state": "active", 
                    "total_pps": "999"
                }, 
                {
                    "free_pps": "599", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk106", 
                    "pv_state": "active", 
                    "total_pps": "999"
                }
            ]
        }, 
        "module_setup": true
    }, 
    "changed": false
}

* Update facts.py

* Update facts.py
2016-09-19 12:20:29 -04:00
Michael Scherer
968101f611 Fix #17624 (#17627)
Even if the size of the network is 0, it should have a netmask.
2016-09-19 11:58:20 -04:00
Nathaniel Case
881da2b3f1 Fix call to axapi_call_v3() (#17637)
Closes #17584
2016-09-19 16:42:23 +01:00
René Moser
6247e7bc38 cloudstack: move common code to module_utils (#17635) 2016-09-19 14:47:03 +02:00
René Moser
3f6f4617dc cloudstack: fix has_changed dict values comparsion (#17632)
In some rare situations, the CloudStack API returns string for numbers
when we expected int.

With this fix, we ensure we compare the types expected.
2016-09-19 14:02:29 +02:00
Peter Sprygada
ff52e01a11 Merge pull request #17625 from skg-net/dellos6_template
Added support for template module for Dell Networking OS6 devices
2016-09-18 22:26:20 -04:00
Peter Sprygada
8f8eb84ebf Merge pull request #17613 from Qalthos/pyez_check
Add simple checks for libraries to junos
2016-09-18 22:25:13 -04:00
Peter Sprygada
79d1b51dfb Merge pull request #17623 from dgjustice/nxos_fixes
Fixed transport issues when calling self.execute from Cli
2016-09-18 22:24:01 -04:00
Joshua Elsasser
fa5f8a7543 Fix slaac filter (#17551) 2016-09-17 23:52:10 +02:00
d3justi
261666a01b Removed checks from Nxapi class. D\'oh\! 2016-09-17 14:40:00 -05:00
d3justi
07f3b27351 added a couple more checks 2016-09-17 14:32:03 -05:00
Senthil Kumar Ganesan
463349c0d1 Added support template module for Dell Networking OS6 devices 2016-09-17 10:55:40 -07:00
d3justi
d34f7c24d9 Fixed transport issues when calling self.execute from Cli 2016-09-17 10:38:24 -05:00
James Cammarata
5a57c66e3c Moving result reading to a background thread 2016-09-17 08:12:52 -05:00
Toshio Kuratomi
2989527cd9 Fix dataloader using deprecated version of is_encrypted (#17615) 2016-09-17 00:45:29 -07:00
Peter Sprygada
6826ed3879 Merge pull request #17622 from privateip/network-plugin-fix
fixes AttributeError: 'Task' object has no attribute '_block'
2016-09-16 22:31:34 -04:00
Peter Sprygada
353f6be273 Merge pull request #17545 from privateip/asa
removes filter attribute from asa
2016-09-16 22:06:19 -04:00
Peter Sprygada
2a7c87a3b7 fixes AttributeError: 'Task' object has no attribute '_block'
This addresses a problem when *_config or *_template network modules are
being used in roles.  The module will error with the above message.  This
fixes that problem

fixed ansible/ansible-modules-core#4840
2016-09-16 22:04:22 -04:00
Matt Clay
07a76bece1 Update submodule refs. 2016-09-16 16:25:47 -07:00
Toshio Kuratomi
ce4c0fd644 Use text strings when using display() to avoid UnicodeError tracebacks 2016-09-16 16:24:19 -07:00
Senthil Kumar Ganesan
bb9ed50441 Renamed the Modules from dnos* -> dellos*, updated copyright, removed… (#17617)
* Renamed the Modules from dnos* -> dellos*, updated copyright, removed dnos6_template

* Addressed @gundalow comments
2016-09-16 22:45:08 +01:00
ftigeot
9df8a2565f Fix distribution fact on DragonFly (#17619)
* By default, ansible_distribution is not set on DragonFly systems,
  preventing some distribution-specific tests from being written

* This commit fixes the issue by returning the quite logical value
  of "DragonFly" when appropriate
2016-09-16 17:32:54 -04:00
nvigot
10f840e80d include_vars now properly deals with hash_behaviour (#15895) 2016-09-16 15:40:38 -04:00
Adrian Likins
3e754086b6 Fix error using jsonfile with incomplete config (#17567)
If 'fact_caching=jsonfile' was configured, but
'fact_caching_connection' was not configured, jsonfile
would fail and ansible-playbook would exit with a traceback.

Fixes #17566
2016-09-16 15:08:02 -04:00
jctanner
29fda4be1e copy action plugin: recurse into sub folders of the source (#17614)
* copy action plugin: recurse into sub folders of the source

Fixes #13013

* Fix python3 bytes/strings

* Fix py3 again

* test
2016-09-16 14:26:19 -04:00
Brian Coca
4e60f23198 remove bare variable support from loops (#17519)
* remove bare variable support from loops

* Added new 'removed deprecated' section to changelg

also added removed items from this PR and others
2016-09-16 12:54:52 -04:00
Toshio Kuratomi
d9c0773609 Update submodule refs 2016-09-16 09:18:19 -07:00
Nathaniel Case
b753e8dc48 Add simple checks for libraries to junos 2016-09-16 11:30:19 -04:00
Andrea Tartaglia
e0a77bb8d5 Pass the absolute path to dirname when assigning basedir (#17457)
* Pass the absolute path to dirname when assigning basedir

If no path is specified when calling the playbook, os.path.dirname(playbook_path) returns ''
This will cause failure when creating the retry file.

Fixes #17456

* Updated to use os.pathdirname(os.path.abspath())
2016-09-16 08:19:43 -07:00
Peter Sprygada
697888965e Merge pull request #17603 from skg-net/dnos10_facts
Added support for facts module for Dell Networking OS10 device.
2016-09-16 08:02:44 -04:00
Toshio Kuratomi
8af8eec789 Merge pull request #17590 from abadger/vault-fixes
Vault fixes
2016-09-15 18:39:34 -07:00
Senthil Kumar Ganesan
769fa1c2d7 Support for dnos10_facts module 2016-09-15 16:16:17 -07:00
Toshio Kuratomi
e70066a6f7 Many Cleanups to vault
* Make is_encrypted_file handle both files opened in text and binary mode
  On python3, by default files are opened in text mode.  Since we know
  the encoding of vault files (and especially the header which is the
  first set of bytes) we can decide whether the file is an encrypted
  vault file in either case.
* Fix is_encrypted_file not resetting the file position
* Update is_encrypted_file to check that all the data in the file is ascii
* For is_encrypted_file(), add start_pos and count parameters
  This allows callers to specify reading vaulttext from the middle of
  a file if necessary.
* Combine VaultLib.encrypt() and VaultLib.encrypt_bytestring()
* Change vault's is_encrypted() to take either text or byte strings and to return False if any part of the data is non-ascii.
* Remove unnecessary use of six.b
* Vault Cipher: mark a few methods as private.
* VaultAES256._is_equal throws a TypeError if given non byte strings
* Make VaultAES256 methods that don't need self staticmethods and classmethods
* Mark VaultAES and is_encrypted as deprecated
* Get rid of VaultFile (unused and feature implemented in a different way)
* Normalize variable and parameter names on plaintext, ciphertext, vaulttext
* Normalize variable and parameter names on "b_" prefix when dealing with bytes
* Test changes:
  * Remove redundant tests( both checking the same byte string)
  * Fix use of format string without format operator
  * Enable vault editor tests on python3
  * Initialize the vault_cipher for VaultAES256 testing in setUp()
  * Make assertTrue and assertFalse take the actual method calls for
    better error messages.
  * Test that non-ascii byte strings compare correctly.
  * Test that unicode strings and ints raise TypeError

* Test-specific:
  * Removed test_methods_exist().  We only have one VaultLib so the
    implementation is the assurance that the methods exist. (Can use an abc for
    this if it changes).
  * Add tests for both byte string and text string input where the API takes either.
  * Convert "assert" to unittest assert functions or add a custom message where
    that will make failures easier to debug.
  * Move instantiating the VaultLib into setUp().
2016-09-15 15:22:06 -07:00
James Cammarata
dfb1c0647e Revert "Move queuing tasks to a background thread"
This reverts commit b71957d6e6.
2016-09-15 17:00:06 -05:00
jctanner
b93de25204 During initial argument evaluation, cast args to string. (#17595)
Later in the stack, further code will check and inform the user that var names must start with a letter
or underscore, so this fix only allows us to get to that previously existing policy.

Fixes #16008
2016-09-15 16:41:11 -04:00
Adrian Likins
2c54a8471f Improve inventory script error messages. (#17589)
When an inventory file looks executable (with a #!) but
isn't, the error message could be confusing. Especially
if the inventory file was named something like 'inventory'
or 'hosts'. Add some context and quote the filename.

This is based on https://github.com/ansible/ansible/pull/15758
2016-09-15 15:42:57 -04:00
Matt Davis
f497d771c8 win_shell/win_command changes + tests (#17557) 2016-09-15 11:25:56 -07:00
Senthil Kumar Ganesan
81072fcba1 Added support OS9 facts (#17591) 2016-09-15 19:22:23 +01:00
Toshio Kuratomi
ebc4d577de Update submodule refs 2016-09-15 09:58:59 -07:00
Brian Coca
cb071e043c updated subrefs 2016-09-15 11:43:50 -04:00
Monty Taylor
cd6e01349e Ensure parent tempdir's existence (#17585)
While doing evil things with action plugins, I hit a code path in which
the mkdir here was failing due to lack of parent dir. Changing this to
makedirs made everything happy. Now, I'd obviously like to understand
why the parent dir exists in some places and not others - but I could
not find anywhere that C.DEFAULT_LOCAL_TMP is ensured to be created.
2016-09-15 09:57:15 -04:00
Toshio Kuratomi
70e63ddf6c Fix cow mode to work with unicode task and play names (#17576)
Fixes #17560
2016-09-14 20:02:35 -07:00
Matt Clay
6787fc70a6 Update submodule refs. 2016-09-14 13:28:34 -07:00
Senthil Kumar Ganesan
68f1705d18 Add action plugin for dnos6_config module (#17553) 2016-09-14 20:55:45 +01:00
Senthil Kumar Ganesan
7d9b07382b Add action pluging for dnos9_template module (#17549) 2016-09-14 20:40:55 +01:00
Senthil Kumar Ganesan
564e02c3c3 Add action plugin for dnos6_template module (#17554) 2016-09-14 20:37:56 +01:00
Senthil Kumar Ganesan
daba7fa057 Moved the dnos10_template.py action plugin to the correct directory (#17550) 2016-09-14 20:28:01 +01:00
Toshio Kuratomi
f4cd1c6321 Fix galaxy's parsing of the command line. (#17569)
Also make the parsing of the action in both galaxy and vault more
robust.

Fixes #17534
May Fix #17563
2016-09-14 11:49:54 -07:00
Adrian Likins
8438da2a34 Make jsonfile cache plugin errors less vague. (#17568) 2016-09-14 14:10:12 -04:00
Adrian Likins
c633022fca [wip] Let jsonfile and memcached cache plugins understand fact_caching_timeout=0 (#17565)
* Add support for no-expiration to jsonfile cache

* Let memcached cache use fact_caching_timeout=0

If fact_cache=memcached and fact_caching_timeout=0
memcached would hit a NameError on _expire_keys
2016-09-14 13:27:42 -04:00
Ryan S. Brown
0bda419f66 Allow AWSRetry class to be created without boto3/botocore installed 2016-09-14 11:34:10 -04:00
Brian Coca
4656b6a846 added msg info to unreachable for oneline callback
fixes #17367
2016-09-14 11:33:01 -04:00
Adam Reznechek
23930d799f Fix cpu facts for hosts missing fields in cpuinfo (16533) (#16535)
Change linux fact gathering to correctly gather ansible_processor_count
and ansible_processor_vcpus on systems without vendor_id/model_name in
/proc/cpuinfo (for ex, ppc64/POWER)
2016-09-13 17:19:33 -04:00
Allen Sanabria
b510abce17 CloudRetry/AWSRetry backoff decorator with unit tests (#17039)
* Added aws_retry decorator function with unit tests

* Restructured the code to be used with a base class.

This base class CloudRetry can be reused by any other cloud provider.
This decorator should be used in situations, where you need to implement
a backoff algorithm and want to retry based on the status code from the
exception.

* updated documentation

* fixed tabs

* added botocore and boto3 to requirements.txt

* removed cloud.py from py24 tests, as it depends on boto3

* fix relative imports

* updated test to be 2.6 compat

* updated method name from retry to backoff

* readded lxd

* Updated default backoff from 2 seconds to 1.1s.

This will be about a total of 48 seconds in 10 tries. This is
configurable.
2016-09-13 16:46:59 -04:00
Brian Coca
60706cc12e doas update (#16997)
hopefully fixes #15597
2016-09-13 16:17:24 -04:00
Peter Sprygada
760fff8564 Merge pull request #17546 from skg-net/dnos9_config
Added support for dnos9_config module
2016-09-13 15:01:10 -04:00
Brian Coca
db8c952ee3 added new ksu method to man page
removed runas refrences, because it was never implemented
2016-09-13 14:40:41 -04:00
Nathaniel Case
5331dd482c Cleanup eos (#17548) 2016-09-13 14:29:06 -04:00
Senthil Kumar Ganesan
c6acf44a7c Added support for dnos9_config module 2016-09-13 10:42:12 -07:00
Nathaniel Case
8b3ae1e806 Cleanup netcfg.py (#17531)
Closes #17412
2016-09-13 13:40:32 -04:00
Peter Sprygada
c9d74e9a6e removes filter attribute from asa
This removes the filter attribute from the asa shared module and moves
the function to the asa_acl module where it was used.
2016-09-13 13:38:41 -04:00
Brian Coca
7450629733 better display for free strategy (#17355) 2016-09-13 12:59:32 -04:00
John R Barker
e326da28ff eos: cmd should be item (#17540)
Was changed during
7fe64ef9b8
however not all look variables were updated.
2016-09-13 17:17:35 +01:00
Abhijit Menon-Sen
07756a4265 Remove extraneous . from VALID_FILE_EXTENSIONS
Otherwise if you «include_vars: vars.json», you get this error:

    "message": "/path/to/vars.json does not have a valid extension: yaml, yml, .json"
2016-09-13 19:41:26 +05:30
Toshio Kuratomi
b0d81a43d7 Update submodule refs 2016-09-13 07:07:12 -07:00
Brian Coca
8ebd8ca259 updated solaris virtualization detection (#17464)
avoid prtdiag since it seems to hang and require service restarts
hopefully fixes #4583
2016-09-13 09:03:05 -04:00
Nathaniel Case
036650cb09 Cleanup junos (#17530)
Closes #17411
2016-09-12 17:42:26 -04:00
Peter Sprygada
076a821821 Merge pull request #17468 from skg-net/dnos9_command
dnos9_command (new module)
2016-09-12 17:04:17 -04:00
Nathaniel Case
bfe341177b Cleanup netcli (#17529)
This honestly mostly amounts to Python 3 fixes.
2016-09-12 16:08:21 -04:00
Toshio Kuratomi
bf29961947 Fixes to the controller text model (#17527)
* Fixes to the controller text model

* Change command line args to text type
* Make display replace undecodable bytes with replacement chars.  This
  is only a problem on pyhton3 where surrogates can enter into the msg
  but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml

* Fix up run_cmd to change its parameters to byte string at appropriate times.
2016-09-12 12:57:41 -07:00
Toshio Kuratomi
9868117d1f Update submodule ref for core to fix broken service module 2016-09-12 11:55:39 -07:00
Toshio Kuratomi
499b13d649 Update submodule refs 2016-09-12 11:32:08 -07:00
Senthil Kumar Ganesan
1c7c3cc878 Addressed review comments from @gundalow 2016-09-12 11:26:22 -07:00
Senthil Kumar Ganesan
3e18676af4 Addded support for dnos9_command module 2016-09-12 11:26:22 -07:00
Nathaniel Case
060ed665f6 Cleanup nxos
closes #17414
2016-09-12 14:20:50 -04:00
Peter Sprygada
5aa83041bf Merge pull request #17474 from skg-net/dnos6_command
Add module_utils/dnos6.py
2016-09-12 13:40:56 -04:00
Peter Sprygada
cc45506006 Merge pull request #17521 from privateip/fix-4797
raise exception when src file is not found in net_config
2016-09-12 13:40:01 -04:00
Nathaniel Case
fcd4be28ee Cleanup openswitch
Also bump get_config in vyos, to pick up the addition of **kwargs

Closes #17415
2016-09-12 13:35:57 -04:00
Senthil Kumar Ganesan
05e016e4aa Addressed @gundalow review comments 2016-09-12 10:08:10 -07:00
Senthil Kumar Ganesan
94df740ca3 Added support for dnos6_command module 2016-09-12 10:08:10 -07:00
Toshio Kuratomi
6117e1946e Check controlpersist (#17443)
* Add a new config option to cache the check for controlpersist on the
control machine.

Fixes #15844

* Remove the option and make the behavior the default

* Make the check for controlpersist cache its status per-ssh executable
2016-09-12 08:27:39 -07:00
Nathaniel Case
2077e32ddd Vyos cleanup
Addresses #17416
2016-09-12 11:19:09 -04:00
Peter Sprygada
16d6274276 raise exception when src file is not found in net_config
This will now raise an exception if the file path specified in src is not
found and the module will gracefully error.

ref #4797
2016-09-12 10:00:35 -04:00
Peter Sprygada
4e325274d6 Merge pull request #17512 from privateip/nxos
roll up of updates to nxos shared module
2016-09-12 09:44:07 -04:00
Peter Sprygada
7777c38b95 Merge pull request #17508 from privateip/sros
updates sros shared module
2016-09-12 09:43:55 -04:00
Peter Sprygada
e83567a8ec Merge pull request #17509 from privateip/vyos
roll up of updates to vyos shared module
2016-09-12 09:43:47 -04:00
Peter Sprygada
560984d282 Merge pull request #17511 from privateip/junos
updates junos shared module methods
2016-09-12 09:43:30 -04:00
Peter Sprygada
7c4dad4275 Merge pull request #17513 from privateip/eos
cleans up load_config() in eos shared module
2016-09-12 09:42:30 -04:00
Peter Sprygada
ebe2400af8 Merge pull request #17510 from privateip/iosxr
clean up iosxr shared module
2016-09-12 09:42:11 -04:00
John R Barker
8a3b520f70 Add missing space in loop variable reuse message (#17516) 2016-09-12 08:35:23 -04:00
Peter Sprygada
f4af154bef Merge pull request #17506 from privateip/openswitch
minor clean of openswitch shared module
2016-09-11 23:57:13 -04:00
Peter Sprygada
db744e1233 Merge pull request #17507 from privateip/netcfg
removes unneeded message in netcfg
2016-09-11 23:57:03 -04:00
nitzmahone
8d1f96dd82 bump core submodule ref for win_user fixes 2016-09-11 20:45:46 -07:00
Peter Sprygada
d2e4ddf0b0 roll up of updates to nxos shared module
* combine same functions into NxapiConfigMixin class
* update Cli and Nxapi to use mixin
2016-09-11 23:40:31 -04:00
Peter Sprygada
e9f804614d removes unneeded message in netcfg
removes old warning message in netcfg that is no longer used
2016-09-11 23:38:44 -04:00
Peter Sprygada
815a683e9c minor clean of openswitch shared module
* updates regexp entries
* removes legacy 2.1 code for get_module()
2016-09-11 23:37:19 -04:00
Peter Sprygada
75f1573ed5 roll up of updates to vyos shared module
* cleans up method signature
* removes save_config method in favor of super class
2016-09-11 23:35:54 -04:00
Peter Sprygada
a6cf394ebc updates sros shared module
* adds rollback to load_config() method
* updates error regexp list
2016-09-11 23:34:46 -04:00
Peter Sprygada
e5d931de6b updates junos shared module methods
* cleans up load_config() arguments to simply
* removes unused methods in Cli transport
* updates error regexp
2016-09-11 23:33:20 -04:00
Peter Sprygada
a8daff1590 clean up iosxr shared module
fixes up method signatures in iosxr shared module removing unneeded **kwargs
2016-09-11 23:32:05 -04:00
Peter Sprygada
456fbf011e cleans up load_config() in eos shared module
cleans up the load_config() method
2016-09-11 23:30:51 -04:00
James Cammarata
f5cff2ced5 Revert "Flush the queued items in linear periodically"
This reverts commit d3418fd658.
2016-09-11 14:28:49 -05:00
Robin Schneider
d76dd56ca3
Use addresses and names reserved for documentation
Trying to preserve the meaning of the examples. Not all occurrences in
`docsite/rst/playbooks_lookups.rst` have been changed for instance to
allow the unchanged examples to be used for testing.

Related to: #17479
2016-09-11 17:31:41 +02:00
James Cammarata
d3418fd658 Flush the queued items in linear periodically 2016-09-10 09:43:49 -05:00
James Cammarata
6b206f5d00 Re-adding processing of results inline with queuing tasks for linear 2016-09-10 09:43:49 -05:00
Chris Houseknecht
39aa740531
Use LooseVersion comparison. Default docker_api_version to 'auto'. 2016-09-10 03:02:50 -04:00
Peter Oliver
c87d84f5b8 Filesystem blocks are of size f_frsize (#17493)
The statvfs(3) manpage on Linux states that `f_blocks` is the "size of fs in `f_frsize` units".  The manpages on Solaris and AIX state something similar.

With ext4 on Linux, I suspect that `f_bsize` and `f_frsize` are always identical, masking this error.  On Solaris, the sizes differ for each of ufs, vxfs and zfs causing the `size_available` and `size_total` facts to be set incorrectly on this OS.
2016-09-09 17:39:39 -04:00
Brian Coca
a3028783d4 removed previously deprecated ';' host separator 2016-09-09 17:32:53 -04:00
Brian Coca
0aaee0272a using delegated host's facts when delegating (#17489)
fixes #17313
2016-09-09 17:26:47 -04:00
jctanner
af2ce7725b Iterate through role paths when installing roles (#17487)
* Iterate through role paths when attempting to install roles
2016-09-09 16:50:50 -04:00
Alvaro Aleman
e8897a9b91 Fix from_yaml for non-string_types. This resolves #17397 (#17398) 2016-09-09 13:21:58 -04:00
Peter Sprygada
19e00cf160 Merge pull request #17481 from privateip/junos
minor update to catch expection if trying close a non existent session
2016-09-09 10:42:05 -04:00
Brian Coca
cd2f60e11a take delegated vars before removing them
fixes #17455
2016-09-09 09:55:24 -04:00
Dag Wieers
2daf527e63 Fix fileglob filter to work just like fileglob lookup plugin (#17480)
The fileglob lookup plugin only returns files, not directories.
This is to be expected, as a mixed list would not be very useful in with_fileglob.
However the fileglob filter does return anything glob.glob() returns.

This change fixes this, so that fileglob returns files (as the name indicates).

PS We could also offer a glob filter for thos that would need it ?

This relates to comments in issue #17136 and fixes confusion in #17269.
2016-09-09 09:37:29 -04:00
Peter Sprygada
1dac6edbe4 minor update to catch expection if trying close a non existent session
This will prevent the junos shared module from throwing an exception if
the session is trying to be closed when it doesn't exist
2016-09-09 09:34:12 -04:00
Dag Wieers
d52a9cee46 Support late evaluation, suppress warnings on SyntaxError (#17462)
See #14304 comments (https://github.com/ansible/ansible/pull/14304#issuecomment-245453209) for more information.
2016-09-09 09:33:23 -04:00
Matt Martz
eefe359d6b Don't use the shell to catch output, catch output in python. Fixes #17137 (#17449) 2016-09-09 09:30:37 -04:00
Dag Wieers
1df924e1d5 Clean up unarchive action plugin (#17429) 2016-09-09 09:27:38 -04:00
Maciej Delmanowski
f5a4677680 Allow for no prefix in the comment filter (#17421)
In the 'comment' filter, if the 'prefix' parameter is set as empty,
don't add an empty line before the comment. To get the previous
behaviour (empty line before comment), set the prefix to '\n'.
2016-09-09 09:23:39 -04:00
Matt Clay
d317560914 Update submodule refs. 2016-09-08 18:09:36 -07:00
Peter Sprygada
686d79a515 Merge pull request #17467 from privateip/netcfg
fixes issue with netcfg not working with match=line and path
2016-09-08 15:48:40 -04:00
Peter Sprygada
457a6ca03e fixes issue with netcfg not working with match=line and path
The difference() method now checks this condition and doesn't filter
the path when match=line
2016-09-08 15:19:12 -04:00
Tobias Wolf
9838d6420a Re-fix the per-item diff output, (#17458)
which got lost in recent big 'performance improvements' merge by @jimi-c.

I had made a previous PR to fix this, then @bcoca had committed an
improved fix. Now it's lost again.

cf: d2b3b2c03e (lost here)
cf:  25e9b5788b (previous fix)

Earlier PR #14849
Earlier issue #14843

Please note that jimi-c broke this last time as well ... seeing a
pattern here.
2016-09-08 11:59:35 -04:00
Edward Marshall
1ec9ac4b70 Defined children for get_vm (#15904) 2016-09-08 08:41:32 -07:00
Abhijit Menon-Sen
032bd1dacf Fix typo 2016-09-08 19:01:37 +05:30
Peter Sprygada
982db58aff Merge pull request #17452 from privateip/netcfg
adds context to diff functions based on config path
2016-09-07 21:49:09 -04:00
Peter Sprygada
d64eaae232 Merge pull request #16553 from ericchou1/devel
Added axapi_authenticate_v3 and axapi_call_v3 for AXAPIv3
2016-09-07 21:41:51 -04:00
Peter Sprygada
08eeb1518a adds context to diff functions based on config path
* difference() now accepts a path keyword to specify comparision domain
2016-09-07 19:40:47 -04:00
Andrea Tartaglia
ba28f1a2da Make ssh_executable available as ansible_ssh_* variable (#17450) 2016-09-07 14:13:11 -07:00
James Cammarata
d1a7e07ccc Fixing another logic issue related to include_role changes 2016-09-07 15:16:11 -05:00
Peter Sprygada
715b800ef1 Merge pull request #17447 from privateip/eos
minor fix in eos shared module returning diff
2016-09-07 15:10:43 -04:00
Peter Sprygada
675e87f68d minor fix in eos shared module returning diff
The diff returned from eos when the transport was set to eapi was as
a dict but is expected to be a str.  This change extracts the diff string
from the dict object and returns it.  The behavior is now consistent
between cli and eapi transports.
2016-09-07 14:26:10 -04:00
Brian Coca
65c373c55a fixed bad condition hiding results 2016-09-07 12:55:03 -04:00
@skg_net
e5b8a177d7 Support files for dnos10_template module (#17399) 2016-09-07 17:35:02 +01:00
Brian Coca
a4abf8da79 Flush cache (#17445)
* transfer module based on pipelining, not tmp

fixes #17381

* added missing flush cache option back
2016-09-07 12:12:41 -04:00
Andrea Tartaglia
dd71469bb7 Added option to change ssh executable path (#17377) 2016-09-07 08:41:43 -07:00
Adrian Likins
07e713e7c6 Fix NameError on 'ansible-vault view' (#17440) 2016-09-07 10:48:01 -04:00
Toshio Kuratomi
8c43750a3e Update submodule refs 2016-09-07 07:23:03 -07:00
Peter Sprygada
d67af04c45 Merge pull request #17431 from privateip/eos
minor roll up of fixes to eos shared module
2016-09-07 08:42:34 -04:00
Toshio Kuratomi
4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
2016-09-06 22:54:17 -07:00
Peter Sprygada
ca95b2ae4f minor roll up of fixes to eos shared module
* added back import of Command object
* fixed eapi requests to handle output format correctly
* get_config() now honors include_defaults kwargs
2016-09-06 22:54:04 -04:00
Matt Davis
f239e1e61f windows async changes and tests (#17400) 2016-09-06 17:38:12 -07:00
nitzmahone
056a7cb957 bump core submodule ref for async_wrapper.ps1 bugfix 2016-09-06 16:52:44 -07:00
Matt Clay
94a0d2afb4 Add partially backwards compatible version of _fixup_perms. (#17427)
Also added a deprecation notice for _fixup_perms.

Resolves issue #17352 (assumes custom actions use recursive=False).
2016-09-06 16:49:59 -07:00
Toshio Kuratomi
1d412059a0 Fix UnicodeError loading plugins with non-ascii in them on python3 2016-09-06 16:35:25 -07:00
Peter Sprygada
113dfc5562 Merge pull request #17426 from privateip/nxos
fixes issue when piping commands through json with output not specifed
2016-09-06 19:24:05 -04:00
Peter Sprygada
52d1187f5c Merge pull request #17425 from privateip/netcli
removes command caching on retrieve from netcli
2016-09-06 19:23:53 -04:00
Peter Sprygada
666b19869b Merge pull request #17424 from privateip/fix-17408
removes unneeded code from netcli
2016-09-06 19:23:41 -04:00
Peter Sprygada
5730c97f9e Merge pull request #17422 from privateip/fix-17407
bug fix for AttributeError: 'str' object has no attribute 'get'
2016-09-06 19:23:28 -04:00
Peter Sprygada
c228dfe692 fixes issue when piping commands through json with output not specifed
There is an issue when piping cli commands through json but the output
is specified as either text or the output is none and the transport is
cli.  The results would not be loaded properly for conditional
evaluation.  This is similar to #17422
2016-09-06 16:55:53 -04:00
Peter Sprygada
da931b04ad removes command caching on retrieve from netcli
The caching of commands in CommandRunner is providing no useful feature
and causing problems.  This removes the code and simply returns the
requested command results.
2016-09-06 16:53:14 -04:00
Peter Sprygada
fbda7d127f removes unneeded code from netcli
Some old remnants of code from the refactor of netcli was left over as
reported in #17408.  This commit removes the old code as it isn't need
and in fact wasnt doing anything
2016-09-06 16:35:06 -04:00
nitzmahone
abbb93e117 bump core submodule ref for windows async 2016-09-06 13:29:45 -07:00
Matt Davis
b860b2d258 windows environment support (#17402) 2016-09-06 13:00:21 -07:00
Peter Sprygada
7fe64ef9b8 bug fix for AttributeError: 'str' object has no attribute 'get'
Exception thrown when using cli transport in eos but piping the command
through json

* eos now checks for `| json` and automatically changes the output type
* adds back import of Command object

tested on EOS 4.15.4F
2016-09-06 15:33:55 -04:00
Toshio Kuratomi
b6d24be09e Update submodule refs 2016-09-06 12:30:20 -07:00
James Cammarata
37f721f315 Remove debug lock 2016-09-06 13:04:50 -05:00
Nathaniel Case
972dc3fc97 Network module cleanup (#17334)
* Clean up EOS, IOS, IOS-XR, Junos, NX-OS, and OpenSwitch

* Cleanup net* files

* Re-add NetworkModule import to network module_utils files

This will trick modules into importing code from module_utils code, thus
including it in the final Ansiballz zipfile.

* Give asa a look over, too
2016-09-06 13:49:48 -04:00
James Cammarata
7a0b25d5fa Fixing incorrect 'task' variable bug in strategy/__init__.py 2016-09-05 23:41:21 -05:00
Marc-André Gatien
d56b0aa813 typo fix for variable ANSIBLE_ETCD_VERSION (#17373) 2016-09-05 23:00:56 -04:00
Michael Scherer
02d9f14b8b Do not crash if current dir do not exist, fix #17369 (#17379)
Do not crash if current dir do not exist
2016-09-05 22:46:47 -04:00
Brian Coca
ff34f5548d Dynamic role include (#17401)
* dynamic role_include

* more fixes for dynamic include roles

* set play yfrom iterator when dynamic

* changes from jimi-c

* avoid modules that break ad hoc

TODO: should really be a config
2016-09-05 20:07:58 -04:00
Peter Sprygada
439aa353f1 fixes bug when template is missing src argument
adds AttributeError to exception handling to change missing src argument

fixes #17391
2016-09-05 08:54:14 -04:00
Peter Sprygada
9c5bcda4fe Merge pull request #17388 from privateip/asa
fix up asa shared module
2016-09-04 20:59:20 -04:00
Peter Sprygada
06c76034dc Merge pull request #17385 from privateip/shell
minor optimizations and clean up in shell.py
2016-09-04 09:21:28 -04:00
Peter Sprygada
1b1c1fe992 Merge pull request #17386 from privateip/netcli
clean up method signatures in netcli
2016-09-04 09:21:17 -04:00
Peter Sprygada
d976c80a22 roll up of updates to junos shared module
* adds implementation for Network methods
* adds action plugin junos_config
* removes _log() and raises exceptions instead to be handled by the module
2016-09-04 08:37:33 -04:00
Peter Sprygada
a839acfa33 clean up method signatures in netcli
removes unneeded **kwargs from methods in netcli
2016-09-04 08:34:37 -04:00
Peter Sprygada
a40515524f minor optimizations and clean up in shell.py
* cleans up method signatures
* drops checking for Command properties that no longer exist
2016-09-04 08:33:26 -04:00
Peter Sprygada
7aa1220b96 fix up asa shared module
* add authorize() method to handle authorization
* move terminal commands to after authorization completed
* add save_config() method to handling writing config to disk
* fix minor issues with get_config
* adds action plugin asa_config
2016-09-04 08:31:40 -04:00
Rene Moser
a6c0f07fbb Update extra module submodule ref, fixes build 2016-09-04 09:43:01 +02:00
Toshio Kuratomi
9ad77a5398 Update submodule refs 2016-09-03 11:21:23 -07:00
Toshio Kuratomi
f7b22a5eaa Fix paramiko's exec_command() to return bytes on python3 (#17372)
* Fix paramiko's exec_command() to return bytes on python3

* Run test_connection for python3 now too

* Fix atomic_move for problem in shippable's testing

* Python-2.4 needs to use b()
2016-09-02 20:32:14 -07:00
Matt Clay
3b2830818e Update submodule refs. 2016-09-02 18:37:54 -07:00
Matt Clay
cfacc1fd53 Pass '_' to async_wrapper for no argsfile. (#17374)
This provides compatibility with changes made to the async_wrapper module.
2016-09-02 18:33:33 -07:00
Matt Clay
bc143a9adb Update submodule refs. 2016-09-02 18:20:41 -07:00
Matt Clay
2392865d69 Update submodule refs. 2016-09-02 12:43:43 -07:00
Toshio Kuratomi
7728d70bea Replace long with int (#17368)
I can't figure out any reason that we'd need to use long explicitly here
as python implicitly moves from a C long int to python Long
automatically under the covers.  My best guess is that it was originally
used so that the facts module would work on python-2.2 where the user
had to convert a number from int to long manually but python-2.4 is our
current baseline.

long isn't present on Python3 so now is a good time to remove this
cruft.  (We had a workaround for Python3; this commit also removes the
workaround.)
2016-09-02 11:26:47 -07:00
Toshio Kuratomi
67177105e3 We now have an exception return value. Make use of it instead of putting the traceback into msg (#17365) 2016-09-02 08:27:01 -07:00
Toshio Kuratomi
6d0755f71e Update submodule refs 2016-09-02 07:19:38 -07:00
Brian Coca
4457985062 added ability to use pure boolean in conditionals 2016-09-02 08:54:38 -04:00
Will Thames
d54f5277d5 Add ksu privilege escalation (#17340)
Allow ksu privilege escalation to be used
as a standard become_method

https://web.mit.edu/kerberos/krb5-1.12/doc/user/user_commands/ksu.html
2016-09-01 16:54:31 -04:00
Peter Sprygada
c8431e334b Merge pull request #17296 from skg-net/devel
Add support for Dell Networking OS10 Command and Config Modules
2016-09-01 10:26:30 -04:00
John R Barker
02308ce27b docs_fragments: Correct spelling mistakes, fix formatting (#16930)
docs_fragments: Correct spelling mistakes, fix formatting
2016-09-01 13:20:13 +01:00
Toshio Kuratomi
88d17642c5 Update submodule refs to sync to_text, to_bytes, to_native changes with usage 2016-09-01 04:20:58 -07:00
Tobias Wolf
c23b11d212 [Inventory] Cache the result of enumerating groups and host names
for `VariableManager._get_magic_variables()`.

This saves a lot of time re-iterating the nearly always constant global
list of groups and their members.

Generate once and cache, and invalidate cache in case `add_host:` or
`group_by:` are used.
2016-09-01 06:19:49 -05:00
Toshio Kuratomi
28227546fa Various python3 updates for module_utils: (#17345)
* Port set_*_if_different functions to python3
* Add surrogate_or_strict and surrogate_or_replace error handlers for
  to_text, to_bytes, to_native
* Set default error handler to surrogate_or_replace
* Make use of the new error handlers in the already ported code
* Move the unittests for module_utils._text as they aren't in basic.py
* Cleanup around SEQUENCETYPE.  On python2.6+ SEQUENCETYPE includes
  strings so make sure code omits those explicitly if necessary
* Allow arg_spec aliases to be other sequence types
2016-09-01 04:19:03 -07:00
Peter Sprygada
d8f0ceee61 Merge pull request #17331 from privateip/openswitch
add Ssh transport class to openswitch shared module
2016-08-31 22:05:30 -04:00
Roman Belyakovsky
d80d986a38 Added to_datetime filter (#17145)
* Added to_datetime filter

* Added to_datetime filter documentation
2016-09-01 01:51:03 +02:00
Senthil Kumar Ganesan
008e79fe74 Removed the unused module imports 2016-08-31 14:36:50 -07:00
Toshio Kuratomi
28429a636d Update submodule refs for fix that new unittest needs 2016-08-31 14:24:34 -07:00
Matt Clay
6744332600 Update submodule refs. 2016-08-31 13:21:41 -07:00
Brian Coca
f39799fbcd implemented loop pausing (#17289)
* implemented loop pausing

- added loop pause to changelog
- only pause between iterations, avoid 1st/last
- added example to docs

* fixed note placement

* else

* added docs for loop_control: label
2016-08-31 16:09:37 -04:00
Matt Clay
e6e541fcb3 Update submodule refs. 2016-08-31 13:09:15 -07:00
James Cammarata
307f98167a Updating submodule reference for core after meta change 2016-08-31 14:14:01 -05:00
Peter Sprygada
4ed8306099 add Ssh transport class to openswitch shared module
This adds a Ssh transport class for working directly with DC config
on OpenSwitch enabled nodes.
2016-08-31 15:06:22 -04:00
James Cammarata
78b8f81cab New feature: add new meta action end_play
This feature also cleans up and extends the meta subsystem:
* Allows for some meta actions (noop, clear_facts, clear_host_errors,
  and end_play) to operate on a per-host basis, meaning they can work
  with the free strategy as expected.
* Allows for conditionals on meta tasks.
* Fixes a bug where (for the linear strategy) metas were not treated
  as a run_once task, meaning every host in inventory would run the
  meta task.

Fixes #1476
2016-08-31 13:59:58 -05:00
Nathaniel Case
01911e4958 Update Junos to NetworkModule (#17197)
* Junos NetworkModule adaption.

* Take CLI_PROMPTS_RE & CLI_ERRORS_RE from ios.py
2016-08-31 14:34:15 -04:00
James Cammarata
b71957d6e6 Move queuing tasks to a background thread 2016-08-31 13:33:01 -05:00
James Cammarata
9ecec6c28e Don't do parent stuff during serialize if squashed or finalized 2016-08-31 13:33:01 -05:00
James Cammarata
cddf1cf98e Some further cleanup in the meta branch
* adds squashing to objects, which allows them to be squashed down
  to a final "view" before post_validate to avoid expensive evaluations
  of parent attributes
2016-08-31 13:33:01 -05:00
James Cammarata
96e2be9bf8 Selectively assign the getter for better performance
Introduces the `inherit` param for FieldAttributes, which is now used
in BaseMeta when constructing the getter property to enhance performance
by reducing the amount of work the getter generally has to do.
2016-08-31 13:33:01 -05:00
James Cammarata
3a51587220 Meta meta meta 2016-08-31 13:33:01 -05:00
Toshio Kuratomi
71ef25d5e8 For module parameter checking, allow conversion of int to float (#17325)
Fixes https://github.com/ansible/ansible-modules-core/issues/4084
2016-08-31 08:57:47 -07:00
Toshio Kuratomi
811fc385ee Update submodule refs 2016-08-31 08:37:26 -07:00
Michael Scherer
acd69bcc77 Fix url lookup for python 3 (#17295)
* Use six instead of urllib2, for python 3 compat

* Open the certificate file using binary mode

On python3, os.write requires 'bytes'. Also avoid
using a too broad exception, since the issue was hard
to spot due to it.

* Do not add the header User-agent if not set

Python3 module do raise a exception if a header is
not a string-like object, and the default value is None.
2016-08-31 07:03:20 -07:00
Andrew Gaffney
f65a3ce547 Support for specifying item label in a loop (#17294) 2016-08-31 09:59:43 -04:00
Peter Sprygada
61e7c3af1a Merge pull request #17315 from privateip/openswitch
minor bug fixes in openswitch shared module
2016-08-31 09:59:30 -04:00
Peter Sprygada
539d13a2cc Merge pull request #17321 from privateip/ios
fixes authorize method in ios shared module
2016-08-31 09:59:08 -04:00
Peter Sprygada
390be19e29 Merge pull request #17320 from privateip/fix-netcli-iterable
fixes issue with converting commands to an iterable was not being done
2016-08-31 07:37:58 -04:00
Peter Sprygada
7fc46e8233 fixes authorize method in ios shared module
The authorize method was calling run_commands() instead of execute().  This
fixes that problem so that authorize() calls are made direclty on the shell
object now
2016-08-31 07:27:39 -04:00
Peter Sprygada
1f9253c032 fixes issue with converting commands to an iterable was not being done
This fix will now force the commands arg in __call__ to be a list of
objects which otherwise would cause netcli not process the stack
2016-08-31 07:21:59 -04:00
Senthil Kumar Ganesan
f12a8a2267 Incorporated Ansible community feedback 2016-08-30 20:05:44 -07:00
Peter Sprygada
ec3dcefd39 minor bug fixes in openswitch shared module
* fix setting cookie after successful login
* raise NotImplementedError if run_commands is called in Rest
* return header msg key if status is not 2xx
* add action plugin ops_config
2016-08-30 23:04:41 -04:00
Allen Sanabria
03132041fb Include vars updated to work with directories (#17207)
* New features for include_vars

include_vars.py now allows you to include an entire directory and its nested directories of variable files.

Added Features..

* Ignore by default *.md, *.py, and *.pyc
* Ignore any list of files.
* Only include files nested by depth (default=unlimited)
* Match only files matching (valid regex)
* Sort files alphabetically and load in that order.
* Sort directories alphabetically and load in that order.

```
    - include_vars: 'vars/all.yml'

    - name: include all.yml
      include_vars:
        file: 'vars/all.yml'

    - name: include all yml files in vars/all and all nested directories
      include_vars:
        dir: 'vars/all'

    - name: include all yml files in vars/all and all nested directories and save the output in test.
      include_vars:
        dir: 'vars/all'
        name: test

    - name: include all yml files in vars/services
      include_vars:
        dir: 'vars/services'
        depth: 1

    - name: include only bastion.yml files
      include_vars:
        dir: 'vars'
        files_matching: 'bastion.yml'

    - name: include only all yml files exception bastion.yml
      include_vars:
        dir: 'vars'
        ignore_files: 'bastion.yml'
```

* Added whitelist for file extensisions (yaml, yml, json)

* Removed unit tests in favor of integration tests
2016-08-30 14:34:31 -07:00
René Moser
26118a51f8 exo_dns: new module utils and integration tests for exoscale DNS (#17230) 2016-08-30 21:48:28 +02:00
Michael Scherer
e3f54cb798 Add support for become_flags on the task level (#17310)
Working on the test suite, I tried to replace a call to sudo to a
call to su, and found out that I can't change user to 'nobody'
without changing the option become_flags in ansible.cfg

As this would be dependent on the user and the task, it make more sense
to push the setting there.
2016-08-30 12:29:00 -07:00
Michael Scherer
65f1eb8e5c Reduce no longer exist in python3, so we have to use six (#17304) 2016-08-30 10:58:22 -07:00
Michael Scherer
adcb87f781 file() function in python3 no longer exist, so use open() (#17303) 2016-08-30 10:47:41 -07:00
Michael Scherer
9245c786db Fix the lines lookup to work on python3 (#17291)
Since stdout is (on python3) of type 'bytes', callbacks
plugins fail in the test suite, because calls backs expect
a string.
2016-08-30 10:38:55 -07:00
Michael Scherer
8f364b549b Fix indexed_items.py to run on python3 (#17292)
On python3, zip is a iterator so we need
to explictily create the list from that.
2016-08-30 09:49:58 -07:00
Senthil Kumar Ganesan
f6aa730c3c Utilities to support DELL Networking OS10 command and config modules 2016-08-29 21:29:26 -07:00
Toshio Kuratomi
54d3a977f2 Update submodule refs 2016-08-29 13:21:02 -07:00
Toshio Kuratomi
fa804125b5 Python3 fixes and porting (#17271)
* Fix to_native call in selinux_context and selinux_default_context to
  use the error handler correctly.
* Port set_mode_if_different to work on python3
* Port atomic_move to work on python3
* Fix check_password_prompt variable which wasn't renamed properly
2016-08-29 09:11:40 -07:00
Peter Sprygada
c16f34bf8e Merge pull request #17279 from privateip/shell
catches timeout error when connecting to remote host in shell
2016-08-29 08:47:48 -04:00
Peter Sprygada
2179677294 Merge pull request #17278 from privateip/nxos
changes nxos method for passing kwargs to get_config()
2016-08-29 08:47:33 -04:00
Peter Sprygada
f5df946e6e Merge pull request #17277 from privateip/eos
fixes two bugs in the eos shared module
2016-08-29 08:47:13 -04:00
Peter Sprygada
820260b22d catches timeout error when connecting to remote host in shell
This will now catch a timeout error when shell attempts to open the
connection to the remove device and gracefully raise it as a ShellError
2016-08-28 23:03:46 -04:00
Peter Sprygada
2cb2ba1fe6 changes nxos method for passing kwargs to get_config()
This change makes both the Cli and Nxapi objects handle the get_config()
method consistently the same
2016-08-28 23:02:36 -04:00
Peter Sprygada
5ce032bf6d fixes two bugs in the eos shared module
* fixes issue with correctly returning the running-config over eapi when a
  call was made to get_config()
* fixes issue the MRO in Cli transport
2016-08-28 22:58:52 -04:00
Abhijit Menon-Sen
a9d5bf717c Merge pull request #17272 from PeterMartini/typo-fix
Simple documentation typo fix, 'iIf' to 'If'
2016-08-27 18:23:00 +05:30
Tobias Rüetschi
457cf49868 univention: add common code for univention corporate server modules (#16172)
* univention: add common code for univention corporate server modules

* univention: try import only univention specific libraries

* Code Review with @2-B, slight API changes and refactoring.

* Added module documentation overview, describing the provided functions
* Moved module-global objects into getter functions, so that we don't
  need to import possibly-unavailable univention modules at the module level.
* Renamed some exports for improved consistency:

  - module_name()    -> module_by_name()
  - orig_ldap        -> ldap_module()
  - ldap             -> uldap()

Note that this introduces slight API changes from the outside. Instead of
directly accessing module properties, you now have module functions with the
same name. Examples:

   - ansible.module_utils.univention.position_base_dn()
   - ansible.module_utils.univention.config_registry()
   - ansible.module_utils.univention.base_dn()
   - ansible.module_utils.univention.config()

* module_utils univention: fix library

* move module_utils from univention to univention_umc, because python import univention fails if library is called univention

* univention_umc: fix intention

* univention: change common code to BSD-2-clause
2016-08-27 09:42:53 +02:00
Peter Martini
15f10ab4bc Simple documentation typo fix, 'iIf' to 'If' 2016-08-26 22:52:12 -04:00
Brian Coca
4e6a7a9e01 allow include_role to specify vars/defaults files 2016-08-26 21:54:59 -04:00
Peter Sprygada
4b679ffd84 Merge pull request #17265 from privateip/iosxr
fixes iosxr configure method to commit the changes
2016-08-26 16:18:01 -04:00
Brian Coca
f25ec5adb3 fix action parsing to avoid conflicts agin 2016-08-26 16:15:55 -04:00
Peter Sprygada
bb630f52ff fixes iosxr configure method to commit the changes
The iosxr configure method did not send the commit command to active the
changes after pushed to the remote device.  This change address that problem
2016-08-26 15:58:06 -04:00
Peter Sprygada
be55bd6cdf disable prompt timestamps upon successful connection to iosxr 2016-08-26 15:09:02 -04:00
Peter Sprygada
66825f094d Merge pull request #17262 from privateip/iosxr
add commit keyword arg to load_config method
2016-08-26 14:26:41 -04:00
Brian Coca
c755ae6a1d updated sub refs 2016-08-26 14:12:15 -04:00
Brian Coca
bd9094c925 include_role (role revamp implementation) (#17232)
* attempt #11 to role_include

* fixes from jimi-c

* do not override load_data, move all to load

* removed debugging

* implemented tasks_from parameter, must break cache

* fixed issue with cache and tasks_from

* make resolution of from_tasks prioritize literal

* avoid role dependency dedupe when include_role

* fixed role deps and handlers are now loaded

* simplified code, enabled k=v parsing

used example from jimi-c

* load role defaults for task when include_role

* fixed issue with from_Tasks overriding all subdirs

* corrected priority order of main candidates

* made tasks_from a more generic interface to roles

* fix block inheritance and handler order

* allow vars: clause into included role

* pull vars already processed vs from raw data

* fix from jimi-c blocks i broke

* added back append for dynamic includes

* only allow for basename in from parameter

* fix for docs when no default

* fixed notes

* added include_role to changelog
2016-08-26 13:42:13 -04:00
Peter Sprygada
eac7caefd8 add commit keyword arg to load_config method
this adds a new keyword arg to the load_config method that will control
whether or not a loaded configuration is committed on the device
2016-08-26 13:16:18 -04:00
Michael Scherer
a30f545a62 Do not convert Nonetype to "None" (#17261)
If someone use a task with a empty name like this:

  - name:
    command: true

This will result in displaying 'None' as a task name instead of
'command'.
2016-08-26 09:48:27 -07:00
Brian Coca
1139d61d59 simplified logic paths 2016-08-26 11:39:12 -04:00
Patrik Lundin
b4f338bca7 Add OpenBSD virtualization facts. (#17227)
* Add OpenBSD virtualization facts.

Patch written by @jasperla.

Tested by various people on:
- virtualbox
- vmware esx(i) + fusion
- kvm (smartos + plain linux + a random cloud provider)

This patch is already present in the OpenBSD port of ansible.

* Rework diff to get rid of extra returns.

Requested by @bcoca.

While here, use four-space indentations of all code blocks.

* Set facts even if no match is found.

Discussed with @bcoca.

* Find sysctl via get_bin_path().

Requested by @bcoca.

* Fail if we do not find a sysctl binary.

* Do not fail if a sysctl binary is not found.

Just set empty fact values instead.
Requested by @bcoca.
2016-08-26 11:27:41 -04:00
Abhijit Menon-Sen
b4a035718e Make _display_plugin_load much less noisy
There was general consensus that displaying every plugin load on -vvv
was *way* too noisy. This commit reformats the log message to be less
verbose, and drops it down to debugging-only level.
2016-08-26 20:28:58 +05:30
Alexander Stock
238cccf166 Fix "Text file busy" exception in atomic_move (#9526) (#17204)
tempfile.NamedTemporaryFile keeps a file handle causing os.rename() to fail with windows based vboxfs: [Errno 26] Text file busy.
Changed NamedTemporaryFile to mkstemp() and added a finally block to unlink the temp file in each and every case.
2016-08-26 07:41:17 -07:00
Michael Scherer
a942758a07 Fix wrong error class (#17259)
AnsibleError is not imported in that file, and since that's
a parsing time issue, better raise AnsibleParserError like the
rest of the file.

Issue signaled on irc by gordon`
2016-08-26 08:53:28 -04:00
Toshio Kuratomi
4a3a9c0f2d Fix for run_command on py3 and enable lineinfile test on py3 (#17257)
* run_command needed a bit of tweaking to its string handling of
  arguments.
* The run_command change fixes the last bit of lineinfile so we can
  enable its tests
2016-08-26 01:30:46 -07:00
Toshio Kuratomi
9ac20e231d Update core submodule to pull in lineinfile py3 fix 2016-08-26 01:07:00 -07:00
Toshio Kuratomi
f57f33a8e7 Fix fetch idempotence (#17255)
Fetch always follows symlinks when downloading so it needs to always
follow symlinks when getting the checksum of the file as well.
2016-08-25 21:45:38 -07:00
Peter Sprygada
fb9b98a543 Merge pull request #17254 from privateip/netcli
adds new property command_string to Command object
2016-08-25 22:51:02 -04:00
Peter Sprygada
9f1ac47f70 adds new property command_string to Command object
This adds a new property to the Command object that is used to hold
modified command strings that could be different from the command used
to create the object.  This allows for seamless switch between text and
json enabled commands.
2016-08-25 22:11:37 -04:00
Peter Sprygada
5036bba2e0 implements command_string property when preparing commands
* commands that need | json added now use command_string property
* adds additonal keyword args in exception handling for json commands
2016-08-25 22:11:23 -04:00
James Cammarata
e375bfd6a5 Use post_validated play for serial calculations in TQM
Fixes #17185
2016-08-25 17:50:22 -05:00
Toshio Kuratomi
0a39700b36 Fix octal output in a few more places (#17250)
Fix filetree lookup plugin for python3 (octal output and selinux API
takes native strings)
2016-08-25 14:58:35 -07:00
Toshio Kuratomi
2dd5e13098 Update submodule refs 2016-08-25 11:04:26 -07:00
Toshio Kuratomi
bd68c324ce Get the ssh plugin working with python3 (#17234) 2016-08-25 10:57:55 -07:00
Chris Faulkner
dbab23e68f Fix context_demo callback plugin. (#17235) 2016-08-25 10:22:27 -07:00
Yann Autissier
8fd3935029 Fix get_distribution for Alpine Linux (#17224)
To override a generic class that is subclassed based on platform, the
subclass must define platform and distribution.

The load_platform_subclass() calls the get_platform() and
get_distribution() methods to detect the platform and the distribution.

On Alpine Linux, get_distribution() method returns None and it is not
possible to have different implementations based on detected platform.
2016-08-25 10:18:42 -07:00