Commit graph

17125 commits

Author SHA1 Message Date
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