Commit graph

29697 commits

Author SHA1 Message Date
Dylan Silva
ac8cb2a106 Downgraded more modules from Curated to Community (#24751) (#24784) 2017-05-18 11:13:47 -07:00
Trishna Guha
af417120e1 Fix transport getting set to None when not set explicitly (#24769) (#24773)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit feafae70b5)
2017-05-18 15:48:55 +05:30
Ganesh Nalawade
3b82490c6f Save commit_timeout as string in junos_config (#24761) (#24764)
Fix converts commit_timeout to string as
Elementree.SubElement requires text as string.

Fixes #24611

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 2f955e7da8)
2017-05-18 13:36:08 +05:30
Adam DeConinck
c5067cff6b Fix for ansible/ansible-modules-core#1568
When checksums of local and remote files match, and when follow = True,
determine if remote destination is a symlink. If so, de-reference it and
pass the link target to the file module as 'dest'.

This change fixes an edge case in file copy behavior when:

- 'dest' is a symlink to some other file ('realdest')
- follow = True
- the checksums of the source file, 'src', and the symlink target, 'realdest',
  match.

Because the checksums match, the copy module is skipped and the file module
is invoked directly with 'dest' = the symlink, and 'src' = the source of the
copy module, whether that source is present on the target machine or not.

When 'src' doesn't exist on the target machine, this leads to an error that
looks like this because it can't change the target of the symlink:

TASK [copy] ********************************************************************
fatal: [192.168.56.101]: FAILED! => {"changed": false, "checksum": "f572d396fae9206628714fb2ce00f72e94f2258f", "failed": true, "gid": 1000, "group": "ajdecon", "mode": "0777", "msg": "src file does not exist, use \"force=yes\" if you really want to create the link: /tmp/issue1568/dest_dir/source", "owner": "ajdecon", "path": "/tmp/issue1568/dest_dir/dest", "size": 8, "src": "source", "state": "link", "uid": 1000}

When the path 'src' *does* exist on the target machine, the file module makes
this the symlink "dest -> src" instead of "dest -> realdest"... even if the
checksum of 'src' on the target machine is different from the checksum of 'src'
on the machine where Ansible is running.

(cherry picked from commit 2f74f6738d)
2017-05-18 02:32:02 -05:00
James Cammarata
180ce9ffe6 Avoid default serialization of classes in dump_attrs
For playbook base objects, when dumping attributes via dump_attrs() an
attribute like loop_control is a class. Using the default serialization
for these is slow and consumes a lot of memory. Since LoopControl is also
based on the Base class, we can use serialize() instead and save a lot of
resources.

This also adds a from_attrs() complimentary method to nicely turn the
dumped attrs back into proper field attributes.

Fixes #23579

(cherry picked from commit 78478e80ea)
2017-05-17 06:57:11 -05:00
Matt Clay
3a6fd9448e Limit sphinx version on python 2.6. (#24678)
* Limit sphinx version on python 2.6.
* Fix issues identified by rstcheck.

(cherry picked from commit 9178e176b5)
2017-05-17 01:07:41 +08:00
James Cammarata
7e605f4e84 Use delegated vars for the delegated host name
In _process_pending_results (strategy/__init__.py), we were using the delegate_to
field directly from the original task, which was not being templated correctly.
As an alternate to #23599, this patch instead pulls the host name out of the delegated
vars passed back in the task result dictionary to avoid having to re-template things.

Fixes #23599
Fixes #20508

(cherry picked from commit e5cd675b38)
2017-05-16 10:46:40 -05:00
Brian Coca
f7318ec891 updated changelog with bugfix 2017-05-15 09:32:58 -04:00
Abhijeet Kasurde
4506da6a6f Fix UnboundLocalError in basic.py
* Fix for UnboundLocalError while accessing deprecations
  in result
* Add Unit test

Fixes #24592

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 764b4b20ec)
2017-05-15 09:32:35 -04:00
Mohammed Naser
a43374ed32 Set facts type to dict
With newer versions of ansible, module arguments are assumed to
be strings unless otherwise specified.  Our 'facts' argument is
expected to be a dictionary, so tell ansible that.

Without this, the argument will arrive as a string and be written
to the facter file inside string quotes.  Facter will produce the
following error:

  undefined method `each' for #<String:0x000000016ee640>

This was originally fixed and found in the Ansible Puppet role which
is maintained by the OpenStack infrastructure team.

8d0f0bfd0a
2017-05-14 14:10:21 -04:00
Ganesh Nalawade
cc18296cc5 Fix timeout issue in ansible-connection (#24556) (#24579)
Fixes #24520 ansible-connection needs
to wait on timeout value of play-context
instead of ssh default timeout
(cherry picked from commit 5ec7f40196)
2017-05-13 18:35:13 +05:30
Eric Beahan
d94ac763b6 removing folded style formatting for synopsis (#22746)
(cherry picked from commit e539726543)
2017-05-12 12:02:07 -04:00
Toshio Kuratomi
40ea76cf5a Add bugfixes to changelog 2017-05-12 05:44:28 -07:00
Toshio Kuratomi
cdd6ab000b Fix template not showing a diff with a directory
Template can take a directory as the destination.  When that's the case,
we need to diff between the source and the file inside of the directory.
That happened when the directory was specified with a trailing slash but
not when it was specified on its own.  This change fixes that.

Fixes #24413

(cherry picked from commit 548cacdf6a)
2017-05-11 20:37:55 -07:00
Toshio Kuratomi
58438762a1 Fix import of shlex_quote
the backport here 1f3f4cf702 forgot that
in ansible-2.3, the six library in ansible.module_utils is only 1.4.
1.4 doesn't have shlex_quote.  Importing it from ansible.compat works
for ansible-2.3.
2017-05-11 17:30:11 -07:00
Toshio Kuratomi
41e3027fda Fix pam_limits writing text to a file opened in binary mode
Fixes #24392

(cherry picked from commit 16325f6f15)
2017-05-11 17:17:53 -07:00
Dylan Silva
6f92ca058a Downgrading module from core to community (#24463) (#24512) 2017-05-11 13:10:19 -07:00
Brian Coca
5a47644dc6 added bugfix to changelog 2017-05-11 15:48:19 -04:00
Brian Coca
1f3f4cf702 deal with null/none connections
fixes #23621
pushed 'connection resolution' to play_context
override fieldattribute getter

(cherry picked from commit c50cf22d52)
2017-05-11 15:47:09 -04:00
Matt Davis
5f0be9dcd0 slightly increase win_async_wrapper fire and forget sleeptime
* should fix Shippable timeouts when AWS CPU credits are low- right on the bubble of failure w/ 5s execution
(cherry picked from commit ead23783be)
2017-05-09 11:23:05 -07:00
James Cammarata
5a3f52d988 New release v2.3.1.0-0.1.rc1 2017-05-09 08:47:02 -05:00
John R Barker
15f635f7c3 Reference correct variable and key for role expiry (#23397) (#24405)
Previously, this module could throw the following error message:
    NameError: global name 'current_roles_attrs' is not defined

The referencing key should also match the name of the column, which is
rolvaliduntil, not rol_valid_until
(cherry picked from commit c5adf08c40)
2017-05-09 14:06:28 +01:00
John R Barker
b87ffb2082 Check if api_key and app_key before proceeding (#24336) (#24403)
Fix adds check if app_key and api_key provided by
user is correct or not. If this combination is wrong
then fail with appropriate error message given by
Datadog server

Fixes https://github.com/ansible/ansible/issues/24325

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit e342b281d8)
2017-05-09 13:27:30 +01:00
Matt Davis
787303284f fix spurious warnings with ansible_winrm_kinit_X args (#24380)
* added to pywinrm arg whitelist
* clarified error text on kinit_mode error
* fixes #23822
(cherry picked from commit 98ff93b2db)
2017-05-08 11:31:03 -07:00
James Cammarata
a1886911fc Fixing security issue with lookup returns not tainting the jinja2 environment
CVE-2017-7481

Lookup returns wrap the result in unsafe, however when used through the
standard templar engine, this does not result in the jinja2 environment being
marked as unsafe as a whole. This means the lookup result looses the unsafe
protection and may become simple unicode strings, which can result in bad
things being re-templated.

This also adds a global lookup param and cfg options for lookups to allow
unsafe returns, so users can force the previous (insecure) behavior.

(cherry picked from commit 72dfb1570d22ac519350a8c09e76c458789120ed)
2017-05-08 11:11:47 -05:00
Martin Kopta
ab399146b4 fixed yum.parse_check_update regex (#24331)
Output of `yum check-update` can contain lines with long package names and long
repository label names, which will be broken into multiple lines, which need to
be sanitized. The solution to this has been fixed and refactored in 2.3 in form
of parse_check_update(), but it still contains subtle bug, which makes such
multi-lines invisible to later logic (such packages aren't included in
parse_check_update()) output. The problem is caused by using '\1' in re.sub(),
instead of proper r'\1', which literally puts unicode symbol \1 into resulting
output.
(cherry picked from commit c4ad0f86c7)
2017-05-08 10:53:08 -04:00
Adrian Likins
572c07ddb3 Fix vaulted vars templating
Use the default repr of AnsibleVaultEncryptedUnicode.data instead
of a custom one, since jinja templating ends up using the repr()
results.

Fixes #23846, #24175

(cherry picked from commit 7fe2064162f0cd34b68814ecff1fd276ac24740c)
2017-05-08 10:16:35 -04:00
Toshio Kuratomi
2cab2118a1 Give user whatever information we have from ssh-keyscan
ssh-keyscan isn't very verbose about errors.  Give the user whatever
information we have available even if it isn't much.  At least they will
know how we were running ssh-keyscan and why there's an error now.

Fixes #19440

(cherry picked from commit 4bf8071889)
2017-05-05 08:35:36 -07:00
Dane Summers
f57d7bb016 Fixes #23285 (#24291)
Makes subversion module --check fail when modified files are in
repository.
(cherry picked from commit 4bd04c299b)
2017-05-04 10:09:16 -07:00
Joris (J.J.M.) Weijters
4a7230aa3c adjusted descriptions in DOCUMENTATION, and fixed type in RETURN
(cherry picked from commit 2a7ce1059d)
2017-05-04 07:39:06 -07:00
Matt Martz
228553f931 Switch last remaining decode to to_text (#24269) 2017-05-03 16:51:51 -05:00
Brian Coca
77fa3f1598 include_vars to delegated only if delegate_facts (#24259)
* include_vars to delegated only if delegate_facts

fixes #24172

* since code is now same, simplified

(cherry picked from commit b731c2d809)
2017-05-03 16:30:25 -04:00
Raúl Cuza
5c8e11ac9f Add ansible-vault encrypt_string doc (#24147)
* Add documentation on 'ansible-vault encrypt_string'
2017-05-03 12:20:39 -04:00
Ganesh Nalawade
c249662e10 Fix junos_rpc and junos_user broken issues (#24238) (#24246)
* Fix junos_rpc and junos_user broken issues

Add persistent connection related changes.

* Fix CI issues

(cherry picked from commit a42b892f70)
2017-05-03 19:58:24 +05:30
Ganesh Nalawade
ec3a5b0e17 Fix netconf port validation and minor doc change (#24210) (#24239)
* Fix netconf port validation and minor doc change

Add check to confirm if `validate_*` funcion is
callable.

Add `config_format` in `junos_facts` documentation

* Fix review comments

(cherry picked from commit 73c24001d9)
2017-05-03 16:02:21 +05:30
Toshio Kuratomi
af018b75f0 Add integration test that modules are loaded from the expected locations (#24170)
* Add integration test that modules are loaded from the expected locations
* Fix ping module to pass PEP8

(cherry picked from commit 3428f42120)
2017-05-01 08:57:31 -07:00
Matt Martz
778173ec07 Fix password prompt matching (#24081)
* Fix password prompt matching

* Add some tests for check_password_prompt

* Prevent pep8 line ends with a space error

(cherry picked from commit 040fb4435a)
2017-05-01 11:18:38 -04:00
Brian Coca
8a604185fd make 2.4 compatible
fixes #24148
2017-05-01 11:18:38 -04:00
Toshio Kuratomi
98d223a51b Facts Timeout was not settable via ansible.cfg
The timeout for gathering facts needs to be settable from three places
(highest precedence to lowest):

* programmatically
* ansible.cfg (equivalent to the user specifying it explicitly when
  calling setup)
* from the default value

The code was changed in b4bd6c80de to
allow programmatically and the default value to work correctly but
setting via ansible.cfg/parameter was broken.

This change should fix setting via ansible.cfg and adds unittests for
all three cases

Fixes #23753

(cherry picked from commit d088030fa6)
2017-05-01 08:00:11 -07:00
Nathaniel Case
0467017a70 Remove provider requirement from nxos_vrf (#24118)
Fixes #23920
(cherry picked from commit dce2d5eea9)
2017-05-01 09:33:32 -04:00
Alberto Murillo Silva
776551afa5 Fix ClearLinux pretty name
ClearLinux has changed its pretty name in os-release file
from: 'Clear Linux Software for Intel Architecture'
to: 'Clear Linux OS for Intel Architecture'

This patch makes the SEARCH_STRING 'Clear Linux' rather than
the full name to make it compatible with the old and new name.

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>
(cherry picked from commit bb234b9206)
2017-05-01 08:53:23 -04:00
Nick Piper
cf224ab31b Minor typo correction varibles -> variables
No impact as variable wasn't used.
(cherry picked from commit 403c142750)
2017-05-01 08:45:01 -04:00
Nathaniel Case
41a70bf9ca Print specific error for BadHostKeyException (#24120)
(cherry picked from commit f9ec06d1dc)
2017-04-28 14:00:53 -04:00
Ganesh Nalawade
6915e026ed Fix exception in junos_package (#24107) (#24116)
(cherry picked from commit 06732acd4c)
2017-04-28 19:49:00 +05:30
Alex Willmer
20c5aee565 Rename fact returned by docker_network to avoid restricted prefix (#23919)
This fixes #23918
2017-04-28 08:47:07 -05:00
Trishna Guha
e509122aad Remove idle ShellError exception and get_exception() method from nxos modules (#24091)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit aa1f922606bd7b884c8920e4b402788665bc4116)
2017-04-28 10:50:38 +05:30
Ganesh Nalawade
ab79e96c3c Fix exception issue in junos_config (#24066)
ParseError execption is added to ElementTree
in py2.7. Prior to py2.7 need catch ExpatError
execption
(cherry picked from commit 7d710882a8)

* Fix python version check issue (#24063)

Fix python version check issue
(cherry picked from commit 1f7c2c63c2)
2017-04-27 20:52:26 +05:30
Nathaniel Case
b4380432f6 Run save inside config mode. (#23977)
* Run `save` before exiting config mode.

* Fix unit tests for `save`

* Allow `save` to be on its own again and introspect success

* Introspecting `compare running` makes this a lot harder.

Move `save` tests to integration tests

(cherry picked from commit fc0bf87c20)
2017-04-27 11:09:38 -04:00
Matt Clay
126878488f Fix bugs in ansible-test units command. (#24044)
* Handle old versions of coverage.
* Handle old versions of setuptools.
* Detect python version for docker/remote units.
* Add sanity override for test constraints.

(cherry picked from commit d662f6f0db)
2017-04-27 11:22:44 +08:00
Toshio Kuratomi
4b2d80f662 Add changelog entry for fetch parameter change 2017-04-26 09:28:29 -07:00