Commit graph

17183 commits

Author SHA1 Message Date
Abhijeet Kasurde
e419a55c71 Add correct URL for docker guide (#27465)
Fixes : #27463

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-30 10:08:43 +01:00
Toshio Kuratomi
4109a82d0a remove wildcards and add boilerplate
* cloud/centurylink
* source_control
* cloud/google
* notification
* cloud/rackspace
* cloud/vmware
2017-07-29 14:13:30 -07:00
Toshio Kuratomi
9a55487dff Remove get_exception usage from amazon modules 2017-07-29 07:02:12 -07:00
Toshio Kuratomi
8de6cff2b1 more wildcards 2017-07-29 07:02:12 -07:00
Toshio Kuratomi
1ee08c0f06 Get rid of more wildcard imports and add boilerplate to more modules
This commit cleans up the following module categories:
* messaging
* inventory
* crypto
* commands
* clustering
* cloud/webfaction
* cloud/docker
* cloud/digital_ocean
2017-07-29 07:02:12 -07:00
Toshio Kuratomi
4e6cce354e Remove wildcard imports
Made the following changes:

* Removed wildcard imports
* Replaced long form of GPL header with short form
* Removed get_exception usage
* Added from __future__ boilerplate
  * Adjust division operator to // where necessary

For the following files:

* web_infrastructure modules
* system modules
* linode, lxc, lxd, atomic, cloudscale, dimensiondata, ovh, packet,
  profitbricks, pubnub, smartos, softlayer, univention modules
* compat dirs (disabled as its used intentionally)
2017-07-28 22:10:17 -07:00
Toshio Kuratomi
0a2cdb2585 New tests for copy recursive with absolute paths
Absolute path trailing slash handling in absolute directories

find_needle() isn't passing a trailing slash through verbatim.  Since
copy uses that to determine if it should copy a directory or just the
files inside of it, we have to detect that and restore it after calling
find_needle()

Fixes #27439
2017-07-28 21:00:51 -07:00
giovannisciortino
7cfd02097c add_hosts.py: Fix add_host does not recognise 'host' alias (#27418)
* add_hosts.py: Fix add_host does not recognise 'host' alias

* add_hosts.py: add note in documentation that 'hosts' alias of name parameter is only available on >=2.4
2017-07-28 17:35:20 -04:00
Adrian Likins
934b645191 Support multiple vault passwords (#22756)
Fixes #13243

** Add --vault-id to name/identify multiple vault passwords

Use --vault-id to indicate id and path/type

 --vault-id=prompt  # prompt for default vault id password
 --vault-id=myorg@prompt  # prompt for a vault_id named 'myorg'
 --vault-id=a_password_file  # load ./a_password_file for default id
 --vault-id=myorg@a_password_file # load file for 'myorg' vault id

vault_id's are created implicitly for existing --vault-password-file
and --ask-vault-pass options.

Vault ids are just for UX purposes and bookkeeping. Only the vault
payload and the password bytestring is needed to decrypt a
vault blob.

Replace passing password around everywhere with
a VaultSecrets object.

If we specify a vault_id, mention that in password prompts

Specifying multiple -vault-password-files will
now try each until one works

** Rev vault format in a backwards compatible way

The 1.2 vault format adds the vault_id to the header line
of the vault text. This is backwards compatible with older
versions of ansible. Old versions will just ignore it and
treat it as the default (and only) vault id.

Note: only 2.4+ supports multiple vault passwords, so while
earlier ansible versions can read the vault-1.2 format, it
does not make them magically support multiple vault passwords.

use 1.1 format for 'default' vault_id

Vaulted items that need to include a vault_id will be
written in 1.2 format.

If we set a new DEFAULT_VAULT_IDENTITY, then the default will
use version 1.2

vault will only use a vault_id if one is specified. So if none
is specified and C.DEFAULT_VAULT_IDENTITY is 'default'
we use the old format.

** Changes/refactors needed to implement multiple vault passwords

raise exceptions on decrypt fail, check vault id early

split out parsing the vault plaintext envelope (with the
sha/original plaintext) to _split_plaintext_envelope()

some cli fixups for specifying multiple paths in
the unfrack_paths optparse callback

fix py3 dict.keys() 'dict_keys object is not indexable' error

pluralize cli.options.vault_password_file -> vault_password_files
pluralize cli.options.new_vault_password_file -> new_vault_password_files
pluralize cli.options.vault_id -> cli.options.vault_ids

** Add a config option (vault_id_match) to force vault id matching.

With 'vault_id_match=True' and an ansible
vault that provides a vault_id, then decryption will require
that a matching vault_id is required. (via
--vault-id=my_vault_id@password_file, for ex).

In other words, if the config option is true, then only
the vault secrets with matching vault ids are candidates for
decrypting a vault. If option is false (the default), then
all of the provided vault secrets will be selected.

If a user doesn't want all vault secrets to be tried to
decrypt any vault content, they can enable this option.

Note: The vault id used for the match is not encrypted or
cryptographically signed. It is just a label/id/nickname used
for referencing a specific vault secret.
2017-07-28 15:20:58 -04:00
James Mighion
a328e96455 Adding aireos_config module (#27408)
* Adding aireos_config module.

* Fixing pep8 W291.
2017-07-29 00:36:04 +05:30
Toshio Kuratomi
cce06c5a3b Fix _get_file_contents to return bytes and checking that a different file exists than it opens 2017-07-28 11:07:43 -07:00
fredericve
095560771c Fixes #17958: use stderr instead of the default stdout for fatal errors (#17962)
* add a callback plugin that sends failures to stderr

* fix warnings
2017-07-28 10:50:15 -07:00
Ganesh Nalawade
43bd993fac Fix fetch configuration in junos_command (#26392)
* Fix fetch configuration in junos_command

Fixes #26358 Add support to fetch configuration
from device in `xml`, `text`, `json`, `set` display
format.

* Add error message if set display is not supported

* Throw error in case of warning for show commands
2017-07-28 23:06:21 +05:30
Mike Wiebe
07b097af7c Fix nxos portchannel force option (#27190)
* Add integration tests

* Fix force option

* Enable nxos_portchannel test

* Satisfy ansibot demands
2017-07-28 13:06:41 -04:00
Nathaniel Case
fb2b3de5e4 Fix nxos_vtep_vni typo 2017-07-28 13:04:08 -04:00
Marko Stanković
0ebc80cbd6 Fix a typo in win_iis_webapplication.ps1 (#27417)
introduced with https://github.com/ansible/ansible/pull/26082/files#diff-bd862e2bbcb44c9c332df7b6cacf6adaR74
2017-07-28 17:24:08 +01:00
David Newswanger
c594f1e1c9 fixed nontype error (#27428) 2017-07-28 21:50:09 +05:30
David Newswanger
3b1f2aeb16 Iosxr attribute error #27122 (#27425)
* WIP fixing iosxr_logging idempotency

* remove debug stuff from module, add teardown section to start of test
2017-07-28 20:07:34 +05:30
Martin Krizek
36c6d0f748 fetch: fail if flat=yes and dest=existing-dir w/o trailing slash 2017-07-28 09:53:50 -04:00
Trishna Guha
6d1bd33aa5 fix iosxr_banner (#27378)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-28 17:09:04 +05:30
Simon Dodsley
26c9007c2d Add Pure Storage Volume module (#26357)
Update documentation to fix typos and define the extend feature
Force size to be a required variable on create as requested.
Change type to bool
2017-07-28 11:24:31 +01:00
Sloane Hertel
91781487ab aws_kms: don't append to unicode - fixes #25786 (#27352)
* AWS key management service fix; statement may not have a principal, and if there is only one AWS principal it will not be a list as expected. Fixes 25786.

* remove len(), only catch exception in function for json.dumps() failure

* use a defined variable and make formatting python 2.6 compatible
2017-07-28 19:36:37 +10:00
Yanis Guenane
9e41fd399b Removing openssl_publickey from pep8 legacy files (#27414) 2017-07-28 11:10:02 +02:00
Trishna Guha
a49c419651 fix nxos_vrf_af nxapi & cli (#27307)
* fix nxapi failure #27142

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* fix nxos_vrf_af nxapi and cli

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-28 09:02:02 +05:30
Matt Clay
51bd07204b Revert "Revert "Allow ini plugin to load file using other encoding than utf8." (#27407)"
This reverts commit 520696fb39.
2017-07-27 18:15:56 -07:00
Toshio Kuratomi
520696fb39 Revert "Allow ini plugin to load file using other encoding than utf8." (#27407)
* Revert "Update conventions in azure modules"

This reverts commit 30a688d8d3.

* Revert "Allow specific __future__ imports in modules"

This reverts commit 3a2670e0fd.

* Revert "Fix wildcard import in galaxy/token.py"

This reverts commit 6456891053.

* Revert "Fix one name in module error due to rewritten VariableManager"

This reverts commit 87a192fe66.

* Revert "Disable pylint check for names existing in modules for test data"

This reverts commit 6ac683ca19.

* Revert "Allow ini plugin to load file using other encoding than utf8."

This reverts commit 6a57ad34c0.
2017-07-27 17:08:31 -07:00
Toshio Kuratomi
30a688d8d3 Update conventions in azure modules
* Remove wildcard imports
* Update GPL header to the one-line form
* Add from __future__ imports
2017-07-27 15:37:26 -07:00
Toshio Kuratomi
6456891053 Fix wildcard import in galaxy/token.py 2017-07-27 15:37:26 -07:00
Yannig Perré
6a57ad34c0 Allow ini plugin to load file using other encoding than utf8.
- New option for ini plugins: encoding
  - Add a new option encoding to _get_file_contents
  - Use replace option in test/runner/lib/util.py when calling decode on stdout/err
    output when diff have non-utf8 sequences
2017-07-27 14:20:18 -07:00
Josh Bradley
31b27819e1 adding lookup plugin for chef_databags (#18403)
* adding lookup plugin for chef_databags

* add missing classes for code-smell
2017-07-27 16:42:32 -04:00
mzizzi
9817ec84a0 [cloud] cast tag values to strings in ansible_dict_to_boto3_tag_list utility (#27396)
* ansible_dict_to_boto3_tag_list cast tag values to string

* ansible_dict_to_boto3_tag_list cast with to_native
2017-07-27 16:15:05 -04:00
David Newswanger
81151ef02c Remove Deprecated Template network modules (#27076)
* removed deprecated networking template modules

* update changelog

* update changelog
2017-07-27 19:40:11 +01:00
mesk41in
0fb64214a4 add support of nested groups in group_by 2017-07-27 11:37:34 -04:00
Trishna Guha
7351ee9a76 fix nxos_interface multiple issues (#27106)
* fix execute_show_command

* fix pep8 issues

* fix AttributeError #26562

* legacy-file remove

* modify execute_show_command output

* fix admin_state up doc

* fix admin_state for all interfaces doc

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-27 19:23:35 +05:30
saichint
9b9a8749da Add integration tests and fix nxos providers (#26913)
* fix issues with python3.x

* Add integration testa and fix for nxos_evpn_vni

* add nxos_evpn_vni to nxos.yaml

* fix get_vtp_config()

* add new integration tests

* fix rollback

* add integration test files
2017-07-27 09:32:35 -04:00
Nathaniel McAuliffe
c94c2831da extracting list from CustomerGateways to match create (#24897)
* Limiting CustomerGateway to dictionary within list of CustomerGateways

* Copying CustomerGateways[0] to CustomerGateway only if it exsits
2017-07-27 09:12:20 -04:00
Trishna Guha
2eaf3571f3 fix state absent nxos_hsrp (#27366)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-27 14:28:46 +05:30
Anil Kumar Muraleedharan
81a9dada1c Added no shutdown command to list (#27360) 2017-07-27 09:53:46 +01:00
Evan Kaufman
589e8fd6bc Added warning for cron jobs containing line breaks (#19184)
Fixes ansible/ansible-modules-core#4312, moved from ansible/ansible-modules-core#4488
2017-07-27 02:19:36 -04:00
Dan O'Brien
d2f34754b2 fixing defaults (#23874)
* fixing defaults

* setting default to null

* setting default values back to null, remove backupsenabled(never used)

* fixing code smell

* whitespace, remove required statement

* doc changes
2017-07-26 21:12:15 -07:00
acrewdson
0f2b3d55b4 'Response' makes more sense here than 'request' 2017-07-26 16:35:49 -07:00
Matt Davis
3f1ec6b862 add custom module type validation (#27183)
* Module argument_spec now accepts a callable for the type argument, which is passed through and called with the value when appropriate. On validation/conversion failure, the name of the callable (or its type as a fallback) is used in the error message.
* adds basic smoke tests for custom callable validator functionality
2017-07-26 16:12:50 -07:00
Matt Davis
53ebe8d441 coerce azure securitygroup priority to int (#27354)
* fixes #22686
* would be better served in the future by using subspec, but it's in too much flux right now
2017-07-26 16:09:31 -07:00
mdawid92
bfdf85e002 [cloud] IAM module returns created keys (#21237)
* return new key, porting https://github.com/ansible/ansible-modules-core/pull/3385/ by defionscode

* fix python3 compatibility

* fixed indentation

* added user_meta field
2017-07-26 16:24:29 -04:00
Brian Coca
b93b9e68d7 ensure prefix in plugin loading to avoid conflicts
when using 'all' to load all plugins were ending in main namespace
creating conflicts with each other and random modulesr
 i.e. when trying to access json callback we were getting json 'parsing' lib
2017-07-26 11:54:13 -04:00
Trishna Guha
498bf4b5be change collection to aggregate (#27325)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-26 20:36:56 +05:30
Martin Krizek
119c9e5d6e Fix using DNF group upgrade/remove api 2017-07-26 07:39:26 -07:00
David Newswanger
8643e9cb34 changed collection arg to argregate on 2.4 network modules (#26649)
* changed collection arg to argregate on 2.4 network modules

* replace users with aggregate in eos_user, junos_user, nxos_user

* added version_added to places where we replaced users with aggregate in the docs

* fix ios_static_route test

* update tests to reference aggregate instead of collection/users
2017-07-26 10:09:17 -04:00
Pilou
9d771f6eea filesystem: workaround bug in xfs_info, use xfs_growfs instead (#25703)
xfs_info is a bash script located in /usr/sbin/ (/sbin is a symlink to
/usr/sbin/) which calls xfs_growfs command. When neither /sbin nor
/usr/sbin are in the PATH environment variable, filesystem module is able to
call xfs_info because /sbin path is hardcoded in get_bin_path method, then
xfs_growfs isn't found because neither /sbin nor /usr/sbin are in the
PATH environment variable.

"xfs_growfs -n" could be used directly instead of xfs_info, the man page
states that: "xfs_info is equivalent to invoking xfs_growfs with the -n
option".

Fixes #24823.
2017-07-26 08:47:12 -04:00
René Moser
bb5b1680f8 composer: docs: fix conflicting statement about defaults (#27313) 2017-07-26 12:43:13 +02:00
Abhijeet Kasurde
b2d609b6f1 Add testcase for ipify_facts (#26421)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-26 12:16:10 +02:00
Rene Moser
e2914a45e1 cloudstack: make facts run in check mode 2017-07-26 11:55:53 +02:00
René Moser
c16b1844a9 cloudstack: cs_facts: add option for custom meta data host (#27290) 2017-07-26 11:49:15 +02:00
Arthur Burkart
90a42d1e53 Updates docs to match module behavior (#26658)
* Updates docs to match module behavior

* Updates docs to match module behavior

Updated using advice from jimi-c

* Removes snippet about git module before v1.8.3

At suggestion of robinro
2017-07-25 23:21:23 -07:00
Trishna Guha
41ce724801 fix nxos_hsrp (#27306)
* fix nxos_hsrp

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* modify nxos_hsrp test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-26 11:38:55 +05:30
Samuel Boucher
5fbd42eca5 Update svc.py
Killed is a valid state
2017-07-25 22:07:51 -04:00
Toshio Kuratomi
225fa5d092 Fix undefined variables, basestring usage, and some associated python3 issues 2017-07-25 15:58:23 -07:00
Toshio Kuratomi
9f7b0dfc30 Remove automatic use of system six
* Enable the pylint no-name-in-module check.  Checks that identifiers in
  imports actually exist.  When we do this, we also have to ignore
  _MovedItems used in our bundled six.  This means pylint won't check
  for bad imports below ansible.module_utils.six.moves but that's
  something that pylint punts on with a system copy of six so this is
  still an improvement.
* Remove automatic use of system six.  The exec in the six code which
  tried to use a system library if available destroyed pylint's ability
  to check for imports of identifiers which did not exist (the
  no-name-in-module check).  That test is important enough that we
  should sacrifice the bundling detection in favour of the test.
  Distributions that want to unbundle six can replace the bundled six in
  ansible/module_utils/six/__init__.py to unbundle.  however, be aware
  that six is tricky to unbundle.  They may want to base their efforts
  off the code we were using:

  2fff690caa/lib/ansible/module_utils/six/__init__.py

* Update tests for new location of bundled six Several code-smell tests
  whitelist the bundled six library.  Update the path to the library so
  that they work.

* Also check for basestring in modules as the enabled pylint tests will
  also point out basestring usage for us.
2017-07-25 15:58:23 -07:00
Jason Tibbitts
ccce74cf7b Avoid using deprecated group_install API
DNF's base.group_install() function accepts a string as its first
argument.  Prior to DNF-2, compatibility code existed which allowed this
function to accept a base.comps.Group object instead.  That is no longer
possible.

Pass "group.id" to base.group_install() instead of "group" to work
around this.
2017-07-25 15:34:22 -07:00
Abhijeet Kasurde
1c87721a86 Add missing import for basic_auth_argument_spec (#27207)
Fix adds a missing import for basic_auth_argument_spec in
netapp module_utils.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-26 07:05:13 +10:00
Brian Coca
4fba9bf23b revert action loader changes to doc, due to error
restoring behaviour in which a missing module is a warning that shows paths searched,
patch incorrectly bypassed detection and ended up in an exception: global name 'module' is not defined
2017-07-25 16:33:30 -04:00
Michael Scherer
4811c7f117 Permit to have a action plugin without a empty module file
Currently, someone writing a action plugin will also need
to have a empty file in the module path to avoid triggering
the error "no action detected in task.".
2017-07-25 15:11:56 -05:00
Toshio Kuratomi
0d290bddda Port cs_facts to the ansible 2.4 facts API (#27257)
* Port cs_facts to the ansible 2.4 facts API

Fixes #27256
References #27254
2017-07-25 12:08:54 -07:00
Toshio Kuratomi
197a360977 Fix undefined vars on python3 and a whole bunch of other cleanup. (#27202)
* Fix undefined vars on python3 and a whole bunch of other cleanup.

References #27193

* No need to catch exception and reraise.  This just obfuscates the traceback
* Build up a list and then join at the end instead of building up a string. list.append() is faster than string concatenation
* No need to extract k, v pairs from one dict to make a second dict and then extract k, v pairs from the second dict.  Iterate over the k, v pairs extracted from the first dict directly instead of building the second dict.
* No need to check if the dict is empty before iterating on it.  Iterating on an empty dict will automatically go to the end of the loop
* Use isinstance instead of type(obj) is class, handles inheritance and is better style
* use to_native instead of v.encode().  We can use the surrogate_or_strict error handler to deal with more potential tracebacks.  Does the right conversion on both Py2 and Py3.
* Convert bool to string before combining it with the string we're building.
* Don't reference unicode directly as unicode does not exist in Python3
* The string resulting from this function will not have a trailing comma
* Simplify the conversion to string int and bool values are now used in string formatting which will use str to transform them without an explicit invocation.
2017-07-25 10:51:53 -07:00
René Moser
a566a7ea2e cloud: cs_user: add feature keys handling (#27285) 2017-07-25 18:07:58 +02:00
Ricardo Carrillo Cruz
3a3bdde869 Fix multiple code and test issues on iosxr (#27267)
* Fix multiple code and test issues on iosxr

It passes the integration tests now.
Fixes #27123

* Fix pep8 issue

* Fix unit tests
2017-07-25 17:21:53 +02:00
TSDominguez
b9a2dc979f Add dist-upgrade and extra_args to zypper module (#21313)
* Implement state='dist-upgrade'

Implements `zypper dist-upgrade` for the zypper module. This follows
how `zypper upgrade` is invoked, except `state='dist-upgrade'`.

Setting name to anything other than '*' would cause the module to error
out. `dist-upgrade` affects all packages and would not make sense to
apply to a specific package.

* Implement option extra_args

Add option to append additional arguments to zypper command. This
should be able to accommodate other options that are not (yet) covered
by zypper module.

Arguments are given as if written in the command line, complete with
dashes.
2017-07-25 11:12:29 -04:00
Abhijeet Kasurde
dfb97b2728 Remove excessive imports from cloudformation_facts (#27209)
Fix removes excessive imports from cloudformation_facts module.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-25 10:53:17 -04:00
James Cammarata
df8fde4d78 Add cookie parsing to fetch_url/open_url
This patch adds cookie parsing to the fetch_url/open_url module_utils
method. The overall result will still contain the key `set_cookie`, however
an additional key (`cookies`) will also be present. This new field is a
dictionary of values. Overall, this should make looking for individual
cookies in the response much easier, as currently the `set_cookie` field
is an amalgamation of the returned set-cookie headers and can be somewhat
difficult to parse.
2017-07-25 10:16:34 -04:00
Eric Johnson
09e9203844 [google] adding a GCE labels module 2017-07-25 09:36:33 -04:00
Yanis Guenane
35ba6d469e openssl_publickey: Standardize implementaton of the module
The OpenSSLObject class has been merged[1]. This commit makes the
openssl_publickey rely on this class and standardize the way openssl
module should be written.

[1] #26945
2017-07-25 15:31:11 +02:00
Yanis Guenane
d72ac0b391 openssl_privatekey: Standardize implementaton of the module
The OpenSSLObject class has been merged[1]. This commit makes the
openssl_privatekey rely on this class and standardize the way openssl
module should be written.

Co-Authored-By: Christian Pointner <cpointner@mgit.at>

[1] https://github.com/ansible/ansible/pull/26945
2017-07-25 15:31:11 +02:00
Toshio Kuratomi
8b34e31e05 Remove the error checking from apply_patch()
The error checking would itself cause a traceback.  The load_config()
function that we'd need to check for errors from only returns None so
there's no way to check for errors via the return value.  In the future
someone could rewrite the load_config function to return useful
information and restore the error checking but for now this is better as
it won't traceback on success and it will let us turn on static analysis
of undefined variables

Fixes #27255
References #27254
2017-07-25 06:12:44 -07:00
Trishna Guha
703eea3da2 eos_logging implementation module (#27093)
* eos_logging implementation module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* eos_logging integration test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* modify aggregate args logic

* changed collection to aggregate

* add blankline

* handle size value outside method
2017-07-25 18:16:04 +05:30
Philippe Dellaert
c00554735f New module: management of the Nuage Networks VSP SDN solution (network/nuage/nuage_vspk) (#24895)
* Nuage module and unit tests with requested changes

* Cleanup of imports

* Adding check on python version

* Adding import try and catch wrappers

* Cleanup of requirements and adding integration tests

* Using pypi package for simulator

* Cleanup of requirements and adding integration tests

* Adding aliases for integration tests

* Adding module to import sanity test skip list

* Revert "Adding module to import sanity test skip list"

This reverts commit eab23af8c5.

* Adding check for importlib and cleanup of requirements
2017-07-25 12:35:03 +01:00
Trishna Guha
e37e736ddb nxos_logging implementation module (#26949)
* nxos_logging implementation module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* pep8 fixes

* nxos_logging integration test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* test typo fix

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* idempotent fix

* rename feature to facility

* make dest_group global var

* remove str from arg_spec
2017-07-25 17:03:54 +05:30
Yanis Guenane
8b22c45a45 Enable integration tests for the crypto/ namespace (#26684)
Crypto namespace contains the openssl modules. It has no integration
testing as of now.

This commits aims to add integration tests for the crypto namespace.
This will make it easier to spot breaking changes in the future.

This tests currently apply to:

  * openssl_privatekey
  * openssl_publickey
  * openssl_csr
2017-07-25 12:18:18 +01:00
René Moser
b3e8fa72ce cloudstack: cs_cluster: remove duplicate code error handling (#27261) 2017-07-25 11:33:58 +02:00
Sloane Hertel
495f91158c fix RETURN docs 2017-07-25 05:21:58 -04:00
Constantin Bugneac
aa341edf4c rds.py - added more attributes to the returned output 2017-07-25 05:21:58 -04:00
Toshio Kuratomi
b26ee657b5 Fix for nonutf8 filenames causing crashes when setting permissions
Fixes #23861
2017-07-25 00:16:30 -07:00
Toshio Kuratomi
035be94271 Fix cloudformation module for import of non-module_utils file 2017-07-24 18:19:32 -07:00
Toshio Kuratomi
59fa35446b Fix undefined vars in cnos module_utils
Fixing undefined vars across the codebase so that we can have pylint
catch them on every commit.

Some of the changes to this module_utils file are Python3 related => The
identifiers exist on python2 but not on Python3.  The changes should be
portable to both py2 (2.6+) and py3.

References #27193
2017-07-24 15:00:49 -07:00
Toshio Kuratomi
84285a741c Various fixes to ec2_vpc_dhcp_options module
* Stringify exception with a nicer error and include traceback
* Give a nice message if boto is not installed
* Fix undefined vars.  Cleaning up all undefined variables so that we
  can run static analysis on new commits.

  References #27193
2017-07-24 14:59:19 -07:00
bfloyd89
1f637f06a5 Make lambda_event.py python 2.6 compatible (#27241)
"Changed in version 2.7: The positional argument specifiers can be omitted, so '{} {}' is equivalent to '{0} {1}'."
2017-07-24 17:01:19 -04:00
Brian Coca
96d577c4c9 endswith supports tuples, nicer 2017-07-24 16:49:01 -04:00
Brian Coca
c7e841e0e4 better reading of 'facts' 2017-07-24 16:35:24 -04:00
Rob
3401a4b330 Rename classic elb modules to match new names applied to application LB modules (#25745) 2017-07-24 16:28:02 -04:00
Toshio Kuratomi
f22c04fa1e leftover from porting become to v2 that's unused
The set_become_default() function is not needed.  All this time, if it
was called it would try to set a value on a passed by value variable
(meaning that it had no effect after returning to the caller).  Since
become has been working in v2, this code is not needed.  Removing.
2017-07-24 10:12:17 -07:00
Toshio Kuratomi
6220c4aea1 Some enhancements to the symbolic_modes change
* Mark _symbolic_mode_to_octal and helper functions as classmethod and staticmethod
  These helpers should be made toplevel functions in their own module.
  For now, make them staticmethod/classmethod so that they can be used
  (and tested) without instantiating an AnsibleModule.
* Move regex compilation out of loops
* Get rid of python-2.4 compat
2017-07-24 10:08:51 -07:00
Dag Wieers
a5eea9042e vmware_host: Small fixes and docs updates (#25144)
* vmware_host: Small fixes and docs updates

This PR includes:
- A fix to no longer require a datacenter folder for adding a host
- Documentation improvements
- Ensure imports are specific

* Update vmware_host

Fix adds following:
* Update logic in vmware_host
* Update example documentation
* Added test case for vmware_host

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-24 13:02:58 -04:00
Abhijeet Kasurde
9649195c26 Refactor getvm method (#27188)
Fix refactors getvm method and modules which are using it.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-24 12:51:26 -04:00
Toshio Kuratomi
fc5d71de0d Fix for to_text and to_bytes error handlers
* surrogate_then_strict doesn't exist.  Switch to surrogate_or_strict
  instead.
* Found some bugs in the _text.py implementation
  * The composed error handlers (error handlers which are made up of two
    or more python encoding error handlers) had a wrong string in it,
    'surrogate_or_escape' doesn't exist.  Replaced that with
    'surrogate_or_replace' which is the correct handler name.
  * Left comment about the implicit conditions that are part of the
    surrogate_then_replace code path

Fixes #23865
Fixes #23861
2017-07-24 09:19:04 -07:00
Toshio Kuratomi
aa9941aaf7 Fix legacy su handling (bad conditional would not fire at the right time) 2017-07-24 10:49:41 -04:00
Toshio Kuratomi
06617548ed Fix undefined vars in network module_utils
References #27193
2017-07-24 07:49:26 -07:00
Ton Kersten
134852e686 #14634: symbolic permissions error (#14994)
This fixes the symbolic notation of the chmod modes, as stated in the man page of chmod (in Linux). This also takes into account that chmod a+x is different from chmod +x. As the second one should take the current umask into account.

Fixes #14634
2017-07-24 06:33:56 -07:00
Ganesh Nalawade
ad4ecf2a64 Fix EntityCollection stacktrace (#27217) 2017-07-24 09:57:52 +05:30
Dag Wieers
be1c517f4d Add example of templating inline using copy module (#19752)
* Add example of templating inline using copy module

The **copy** module documentation implies that `content:` only works
for 'simple values' and for complex stuff you need the **template**
module, but that is an understatement. You can use **copy** to template
anything you desire.

So I changed the wording, added an example, and also added a note
to the template module that the **copy** module could be used for
'inline templating'.

This fixes #19741.
2017-07-22 22:12:31 -07:00
Toshio Kuratomi
4e8b28e404 Switch from map and filter to list comprehensions and generator expressions (#27198)
One of the complex map + filter + lambda combinations here was causing
pylint to have a rare false positive detecting undefined variables.

Switch to list comprehensions and generator expressions which are
easi(er) to read for humans and do not confuse pylint.

References #27193
2017-07-22 19:12:35 -07:00
Sam Doran
1c40631382 Use atomic_move rather than writing in place in redhat_subscription (#27132)
* Use atomic_move rather than writing in place in redhat_subscription and redhat utils

* Change status to curated

* Put curated in the proper field

* Add RETURN doc section

* Disable yum plugins when unregistering

* Change back to community supported

* Alphabetize imports
2017-07-21 18:22:58 -04:00
Evan Kaufman
e8a396be16 cron - validate filename portion of cron_file param (#19185)
* Validated filename from `cron_file` param, updated docs

Fixes ansible/ansible-modules-core#4795, moved from ansible/ansible-modules-core#5361

* Broke long warning message over multiple lines

See: https://github.com/ansible/ansible/pull/19185#issuecomment-302961152
2017-07-21 23:51:34 +02:00
Thomas Krahn
141c6d0d9d ipa_sudorule: Fix bug: get_sudorule_diff() takes exactly 2 arguments (3 given) (#21150) 2017-07-21 23:39:43 +02:00
Andrea Scarpino
4fb5221b5f timezone: Assuming UTC when no /etc/localtime exists (#27131) 2017-07-21 23:15:06 +02:00
Michael Scherer
e2d6ecfa40 Workaround python-libselinux API change (#25685)
In the past, selinux.security_get_boolean_names did return 'bytes'
on python 3, but this was changed to return string later, cf:
b8711e2eaf

So we have to convert to bytes only if the API return us bytes.

Fix #25651
2017-07-21 10:14:22 -07:00
Abhijeet Kasurde
ede82e2130 Implement vmware_argument_spec for required params (#25731)
Without the fix hostname, username and password params
used to skip required check.

Fixes #25696

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-21 12:12:43 -04:00
Toshio Kuratomi
007a3b9c9b Don't need to convert cmd to bytes as it is already an array of bytes
Fixes #27016
2017-07-21 11:55:43 -04:00
Yanis Guenane
70f52e3043 crypto: Build a base object for openssl modules (#26945)
More openssl modules are about to be made, each of them rewriting
some pieces of code that can be refactored and used via a common
library.

This commit aims to create this "base" object and the common functions
one might want to reuse in order to avoid duplication.
2017-07-21 11:54:04 -04:00
David Newswanger
fd771e580f replace str with to_native (#27135) 2017-07-21 09:32:57 -06:00
Anil Kumar Muraleedharan
08327fa459 Changing new Device name from <Device Name>_cnos to <Device Name> (#27025) 2017-07-21 11:18:59 +01:00
McBadass
0229476c44 Added ability to specify destination OU when joining a domain (#22393)
* Added ability to specify destination OU when joining a domain

* Updated win_domain_membership documentation to include OU destination option.

* Updated python to include version

* Additional info in the docs
2017-07-21 10:50:54 +10:00
Brian Coca
899527f3cb make yaml extensions configurable
fixes #25419
2017-07-20 20:29:09 -04:00
Brian Coca
aca11a28a2 allow for null values in yaml inventory (#26765)
* allow for null values in yaml inventory

* 3 dad3 dad3 dad3 dad3 dad3 dad3 dad3 dad
2017-07-20 20:28:09 -04:00
Jordan Borean
5c6e5d4841 win_domain_group: new module (#26682)
* win_domain_group: new module
2017-07-20 17:08:08 -07:00
Dag Wieers
18d9c34e9d win_command, win_shell: Use Fail-Json on failure (#26512)
Two reasons to do this:
- It provides a proper error message indicating why it failed
- It conforms to what is being done in the command and shell modules
2017-07-21 07:34:48 +10:00
Toshio Kuratomi
3a2afc7825 Allow copy to writable files in unwritable dirs (#23509)
unsafe_writes currently allows updating a file that can be updated but
not removed (for instance, when docker mounted).  This change also
allows unsafe_writes to write to writable files in unwritable dirs. For
instance, if a system has made a single file inside of /etc/ writable to
a specific normal user.

Fixes #14961
2017-07-20 12:41:57 -07:00
Andreas Olsson
063f5d0ca8 Set default user-agent for module_utils.urls fetch_url (#27095)
The HTTP User-Agent "ansible-httpget" is already kind of the default,
it being the default value provided by the `url_argument_spec` helper
method. Yet, it may not be practical for all modules to get their
argument_spec that way.

Without a default User-Agent we fall back on the library
User-Agent. That being something like "Python-urllib/2.7".

While I'm no big fan of web servers making decisions based on the
provided User-Agent I still think that part of being a well-behaved
HTTP client is to provide an informative User-Agent. Not to mention
that it's a good thing for Ansible to behave consistently.

Indirectly fixes #26239
2017-07-20 12:34:41 -07:00
Anil Kumar Muraleedharan
7c65272e2d Removing _cnos from all new devices added (#27101) 2017-07-20 12:34:08 -07:00
Ricardo Carrillo Cruz
857726e6b1 Make the 'not found' regex case sensitive (#27100)
Turns out in some commands, like 'sh bgp summary' a line containing
'Not found' can be shown as a column.
This causes those commands to error out with RC=1 .

Fixes #26577
2017-07-20 12:33:18 -07:00
Nathaniel Case
85e7e342b0 nxos_bgp_af correct parents (#26996)
* move config location

* client-to-client is inverse of BOOL_PARAMS
2017-07-20 13:42:26 -04:00
James Cammarata
640d057f3f Don't use _raw_params for IncludeRole objects (#26601)
IncludeRole objects don't use _raw_params for the name/etc. of roles
like regular incudes, but the code for finding relative includes assumed
that all includes had a _raw_params field. This fixes that by correctly
checking the parent object type and using the appropriate field.

Fixes #26525
2017-07-20 12:32:06 -05:00
Thomas Stringer
bf63301b34 Fix bug that was uncovered by comparing the port range which is inherently a string but ansible passes the param in as an implied int if the range does not contain a non-numeric char (#27017) 2017-07-20 11:47:43 -04:00
Gabor Lekeny
7eab802669 SSH fails with '"parsed": false' error message
Fixes: #15436
2017-07-20 08:09:42 -07:00
Brian Coca
8e0b89bdbf corrected precedence, added comments to each entry 2017-07-20 11:07:06 -04:00
Toshio Kuratomi
f86ce0975d Add a directory walker to copy
* We need a directory walker that can handle symlinks, empty directories,
  and some other odd needs.  This commit contains a directory walker that
  can do all that.  The walker returns information about the files in the
  directories that we can then use to implement different strategies for
  copying the files to the remote machines.
* Add local_follow parameter to copy that follows local symlinks (follow
  is for remote symlinks)
* Refactor the copying of files out of run into its own method
* Add new integration tests for copy

Fixes #24949
Fixes #21513
2017-07-20 08:01:29 -07:00
Toshio Kuratomi
753a3a03d0 Revert "Fix for recursive copy slowness"
This reverts commit 78ced5318f.

The fix for copy slowness did not handle circular symlinks.
2017-07-20 08:01:29 -07:00
Pilou
556a1daa33 fix searched paths in DataLoader.path_dwim_relative (avoid AnsibleFileNotFound) (#26729)
* add unit test: nested dynamic includes

* nested dynamic includes: avoid AnsibleFileNotFound error

Error was:
Unable to retrieve file contents
Could not find or access 'include2.yml'

Before 8f758204cf, at the end of
'path_dwim_relative' method, the 'search' variable contained amongst
others paths:
'/tmp/roles/testrole/tasks/tasks/included.yml' and
'/tmp/roles/testrole/tasks/included.yml'.
The commit mentioned before removed the last one despite the method
docstrings specify 'with or without explicitly named dirname subdirs'.

* add integration test: nested includes
2017-07-20 10:26:13 -04:00
Jack Price
aed35aba70 Always set result variable in cloudflare_dns module (#23683)
Fixes #23682
2017-07-20 14:16:37 +02:00
Ganesh Nalawade
5ab8d30d10 Add net_vrf implementation for junos (#27055)
*  junos_vrf implementation
*  junos_vrf integration test
*  net_vrf integration test for junos
2017-07-20 11:20:18 +05:30
Yanis Guenane
f40db199aa openssl_*: Allow user to specify privatekey passphrase
Allow a user to specify the privatekey passphrase when dealing with
openssl modules.
2017-07-19 18:21:30 -07:00
Jordan Borean
a260063ffd Added function to convert camelCase to snake_case for powershell (#26203)
* Added camel case to snake case converters

* removed uneeded shebang

* renamed util to remove PowerShell from the name
2017-07-19 16:57:05 -07:00
David Newswanger
9f64e446c6 Fix #26918: IOS TypeError (#26999)
Fix IOS TypeError

* if flags are None, then ' '.join(flags) fails
* fixed get_defaults_flag so that it returns a list, and ignores lines with white space

Fixes #26918
2017-07-19 15:06:11 -07:00
David Newswanger
0b5b5ec50a fix unicode errors in iosxr 2017-07-19 14:51:35 -07:00
Pierre-Louis Bonicoli
045f0ff520 deprecated msg: fix a typo 2017-07-19 17:23:41 -04:00
Thomas Stringer
3ffe44c70d remove param vm_id in VirtualMachine constructor call (#22974) 2017-07-19 17:05:46 -04:00
Toshio Kuratomi
df15583ad0 Promulgate house's fix for docker_volume to docker_secret
* Revert change to docker_common as it's not as good as the try: except fix
* limit docker_volume fix to ImportErrors
* fix docker_secret i nthe same way
* Remove docker_secret from import tests
2017-07-19 13:20:47 -07:00
Will Thames
ef8c9798d3 include_role handlers bug fix (#26335)
* Ensure that include_role properly fires handlers

include_role needs to ensure that any handlers included
with the role are added to the _notified_handler and
_listening_handler lists of the TaskQueueManager, otherwise
it fails when trying to run the handler.

Additionally, the handler needs to be added to the
PlayIterator's `_uuid_cache` or it fails after running
the handler

Add more uuid debug statements - this code was hard
to debug with existing debug statements, so add more
uuid information at little additional output cost.

Fixes #18411

* Add tests for include_role handlers

Tests for #18411
2017-07-19 15:02:32 -05:00
Chris Houseknecht
2e073e73d2 Fixes doc string in docker_volume (#27074) 2017-07-19 15:42:31 -04:00
Matt Davis
96a0bdeac5 fix docker_volume import error when docker Python package is missing 2017-07-19 12:33:57 -07:00
Michael Scherer
1289322147 Initial working prototype of a salt bus connection plugin (#12836) 2017-07-19 12:48:50 -06:00
Nathaniel Case
56a0b988a9 nxos integration fix part 1 (#27069)
* Assorted Python 3 fixes

* Fix `testcase` definition in integration tests

* Fix nxos_acl_interface

* clean up nxapi after nxos_nxapi
2017-07-19 14:00:05 -04:00
James Mighion
b8337ee9d3 New module aireos_command (#26769)
* Adding ciscowlc_command module and unit tests.

* Adding __init__.py for unit test.

* Fixing PEP8 W503.

* Renaming module from ciscowlc_command to aire_command.

* Renaming aire_command to aireos_command.
2017-07-19 23:14:52 +05:30
Alex Grönholm
657ab58139 Added the docker_volume module (#24957)
* Added the docker_volume module

* Code style fixes

* Added yours truly to the copyright statement

* Added documentation link

* Fixed YAML syntax in documentation string

* Documentation style fixes based on the code review

* Implemented requested code corrections

* Added documentation for the "labels" option
* Handled APIErrors from docker-py
* Fixed the type of the "labels" option (dict -> list)

* Fixed typo

* Import APIError from docker_common, not from docker-py
2017-07-19 13:43:54 -04:00
Frederic Lepied
65d093d9a7 Skip f5 tests if f5-sdk is not installed (#27035)
Fixes: bug #27034

Introduced by 278fa552f8
2017-07-19 10:09:25 -06:00
Tim Rupp
09e9b4b4ba Adds refactored bigip_monitor_tcp (#26842)
This module needed to be refactored to use the REST API and
coding conventions for newer modules. This patch adds those changes.
This patch also deprecates params in favor of separate modules. These
deprecated params will be removed in 2.5.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_monitor_tcp.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_monitor_tcp/tasks
2017-07-19 10:07:18 -06:00
Andreas Olsson
593297d7a2 Only use git verify-tag when verifying annotated tags (#26414)
* Only use `git verify-tag` when verifying annotated tags

The command `git verify-tag` only applies to annotated tags. When
verifying lightweight tags, which are more similar to non-moving
branches, one has to use `git verify-commit` instead.

Using ':' as a separator is appropriate since that is one of the
characters not allowed in a Git reference name.

See also https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html

* Improve testing of the Git module's gpg verification
2017-07-19 11:30:12 -04:00
Andreas Olsson
779d05aec4 Support tilde (~) paths for unarchive creates tests
This expands the value of the creates parameter the same way which the
value of the dest parameter is already being expanded.

Fixes #26965
2017-07-19 11:13:17 -04:00
Yanis Guenane
bc30dddb81 openssl_publickey: Allow one to specify the output format (#27031)
Public key can be extracted extracted in different format from
the PEM formatted RSA pair.

This commit allows the user to specify the format s/he wants to generate
the public key:

  * PEM
  * OpenSSH
2017-07-19 08:48:11 -04:00
Yanis Guenane
1dc608f2cf OpenSSL modules uses file_common_args (#27032)
* openssl_publickey: Allow one to specify file permission

Allow a user to specify file permissions on the generated publickey via
the file module common arguments.

* openssl: Add documentation regarding file_common_args

Add documentation for those modules to let the user know that he can
rely on file_common_args to specify file permissions.
2017-07-19 08:47:23 -04:00
danielerez
317ad54599 ovirt: ovirt_host_storage_facts (#26184)
Added 'ovirt_host_storage_facts' module to retrieve
a list of HostStorage[1] objects by a specified iscsi
target and address.

E.g.
- ovirt_host_storage_facts:
    vm: myhost
    iscsi:
      target: iqn.2016-08-09.domain-01:nickname
      address: 10.34.63.204

[1] http://ovirt.github.io/ovirt-engine-api-model/master/#types/host_storage

ISSUE TYPE
* Feature Pull Request

COMPONENT NAME
* lib/ansible/modules/cloud/ovirt/ovirt_host_storage_facts.py

@machacekondra
@mureinik @maorlipchuk
2017-07-19 07:25:47 -04:00
Sloane Hertel
79e54f4006 [cloud] s3_bucket: policy comparison - fixes #25428 (#25723)
Creates a new way to compare bucket policies by making their elements hashable & comparing that way after normalizing syntax like single-item lists.
2017-07-19 07:01:33 -04:00