Commit graph

8177 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