Commit graph

98 commits

Author SHA1 Message Date
Brian Coca
9217fbb7dd
better error messasge (#42770)
* better error messasge
2018-07-19 12:13:09 -04:00
Sam Doran
0ca61e9d87
Only report change when home directory is different on FreeBSD (#42865)
* Only report change when home directory is different

Add tests with home: parameter

Have to skip macOS for now since there is a bug when specifying the home directory path for an existing user that results in a module failure. That needs to be fixed in a separate PR.
2018-07-19 10:07:00 -04:00
dgeo
ae96ba0d4f fix a (forgotten?) change in moving createhome -> create_home (#42711)
* fix a (forgotten?) change in moving createhome -> create_home

Fix for following bug on FreeBSD host whith user module:
```
fatal: [webssp]: FAILED! => {"changed": false, "module_stderr": "X11 forwarding request failed
Traceback (most recent call last):
  File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 2487, in <module>
    main()\n  File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 2426, in main
    (rc, out, err) = user.modify_user()
  File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 1011, in modify_user
    if (info[5] != self.home and self.move_home) or (not os.path.exists(self.home) and self.createhome):
AttributeError: 'FreeBsdUser' object has no attribute 'createhome'
", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
```
It happenned with 'createhome' AND with 'create_home' form, with python 2.7 AND python 3.6

* Add changelog


Co-authored-by: dgeo <dgeo@users.noreply.github.com>
2018-07-16 16:55:57 -04:00
Filippo125
5864871fc1 Zabbix inventory improvement (#42669)
* Add validate_certs option to zabbix inventory

* Add validation option

* Fix pep8

* Add changelog
2018-07-14 09:10:16 -04:00
jamessemai
dc32842573 win_security_policy: Allow setting a value to empty (#42051)
* win_security_policy: allow removing values (resolves #40869)

* Removing warning

* Adding test for remove policy setting

* Fixing string comparison

* Make idempotent

* Adding idempotency and diff test

* added changelog fragment
2018-07-13 14:08:14 +10:00
Jordan Borean
e3521776f5
win_chocolatey: add TLSv1.2 support for install phase (#41992) 2018-07-13 13:38:24 +10:00
Jordan Borean
d723b8541d changed winrm _reset to reset and make ssh reset show warning (#42651)
* changed winrm _reset to reset and make ssh reset show warning

* minor changelog update
2018-07-11 20:22:01 -07:00
Matt Davis
a5fc9a17f0
return wu result from inner job (#42647)
fixes #42423
2018-07-11 18:01:42 -07:00
Brian Coca
e115e6496f
preserve delegation info on no_log (#42577)
* preserve delegation info on no_log

fixes #42344
2018-07-11 20:41:37 -04:00
Jerry Chong
42f44b24c6 Fix NameError in pause module (#42038)
* Fix NameError in pause module

* Add comment and changelog

Co-authored-by: Jerry Chong <jchong@netbase.com>
2018-07-11 11:49:32 -04:00
Jordan Borean
940d4a0e89
win_reboot: fix 2.6 issues and better handle post reboot reboot (#42330)
* win_reboot: fix 2.6 issues and better handle post reboot reboot

* changed winrm _reset to reset

* Add handler to reset calls when .reset() throws an AnsibleError on older hosts

* Moving back to _reset to get the issue fixed
2018-07-11 09:12:29 +10:00
Andreas Calminder
577e66660d Simple file locking feature (#42024)
* class for file locking feature
2018-07-10 14:13:27 -07:00
Brian Coca
937e710485
ensure 'text' source assumptions (#42522)
* ensure 'text' source assumptions
2018-07-10 09:45:37 -04:00
Brian Coca
1c08eb8b27
fix irc module to work with py3 (#42267)
* fix irc module to work with py3

fixes #42256
2018-07-10 09:42:14 -04:00
Toshio Kuratomi
673c55f2ef Separate some 255 exit codes that are not ssh errors
The ssh connection plugin is overzealous in thinking that error code 255
can only come from ssh.  Python can return 255 in some circumstances and
error from php does as well.
2018-07-09 15:51:20 -07:00
Toshio Kuratomi
9350a81ae4 Port modules away from __file__
* __file__ won't work if we want to invoke modules via -m or if we
  figure out how to keep modules from hitting the disk with pipelining.
* module.tmpdir is the new way to place a file where it will be cleaned
  automatically.

Change format string to not depend on __file__:

* cloud/amazon/ec2_elb_lb.py
* cloud/amazon/elb_classic_lb.py

Use module.tempdir:

* packaging/os/apt.py
* files/unarchive.py
2018-07-09 15:51:20 -07:00
Matt Martz
abb05c98f3 Make sure we are comparing bytes extensions in inventory plugins (#42475)
* Ensure we are comparing text paths with extensions. Fixes #42118

* Add changelog
2018-07-09 12:24:51 -04:00
Sam Doran
1d1595b990
Fix pause module so it does not stack trace when redirecting stdout. (#42217)
* Use separate variables for stdin and stdout file descriptors

* Do not set stdout to raw mode when output is not a TTY
2018-07-06 17:19:55 -04:00
Jill R
8606fb33f0 Add additional puppet options (#42218)
* Add additional puppet options

Add support for puppet options --debug, --verbose, --summary,
and extend logdest to support logging to stdout and syslog at
the same time.

Fixes issue: #37986

* Fix docs

* Doc fix, add release note

* Fix silly yaml error

* Correct changelog, add C() to params in doc
2018-07-06 13:52:17 -04:00
Jordan Borean
8bdd04c147 Fix remote_tmp when become with non admin user (#42396)
* Fix tmpdir on non root become

 - also avoid exception if tmpdir and remote_tmp are None
 - give 'None' on deescalation so tempfile will fallback to it's default behaviour
   and use system dirs
 - fix issue with bad tempdir (not existing/not createable/not writeable)
   i.e nobody and ~/.ansible/tmp
 - added tests for blockfile case

* Revert "Temporarily revert c119d54"

This reverts commit 5c614a59a6.

* changes based on PR feedback and changelog fragment

* changes based on the review

* Fix tmpdir when makedirs failed so we just use the system tmp

* Let missing remote_tmp fail

If remote_tmp is missing then there's something more basic wrong in the
communication from the controller to the module-side.  It's better to
be alerted in this case than to silently ignore it.

jborean and I have independently checked what happens if the user sets
ansible_remote_tmp to empty string and !!null and both cases work fine.
(null is turned into a default value controller-side.  empty string
triggers the warning because it is probably not a directory that the
become user is able to use).
2018-07-06 10:49:19 -07:00
Toshio Kuratomi
ae55e9f5d6 fix changelog (#42272) 2018-07-03 14:31:19 -04:00
Abhijeet Kasurde
087fc0c20c Restore BOOLEANS import in basic.py (#42008)
This import was removed by mistake. This is required for backward
compatibility.

Fixes: #41988

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-07-02 10:27:16 -04:00
Sam Doran
fb55038d75 Add warning when using an empty regexp in lineinfile (#42013)
* Revert "Account for empty string regexp in lineinfile (#41451)"

This reverts commit 4b5b4a760c.

* Use context managers for interacting with files

* Store line and regexp parameters in a variable

* Add warning when regexp is an empty string

* Remove '=' from error messages

* Update warning message and add changelog

* Add tests

* Improve warning message

Offer an equivalent regexp that won't trigger the warning.
Update tests to match new warning.

* Add porting guide entry for lineinfile change
2018-06-29 17:15:43 -07:00
Brian Coca
b6f2aad600 ignore ansible.cfg in world writable cwd (#42070)
* ignore ansible.cfg in world writable cwd
 * also added 'warnings' to config
 * updated man page template
2018-06-29 16:46:10 -07:00
Brian Coca
de0e11c0d5 avoid loading vars on unspecified basedir (cwd) (#42067)
* avoid loading vars on unspecified basedir (cwd)
2018-06-29 16:45:38 -07:00
Olli-Antti Kivilahti
8eacbd0381 elasticsearch_plugin - Show STDERR on module failures. (#41954)
* elasticsearch_plugin - Show STDERR on module failures.

I tried to install a ES plugin without
  become: yes
and found after debugging the module that the module failed ude to permission issues.

The only error message I got was
  Is analysis-icu a valid plugin name?

That was strange considering I followed the example documentation by the letter.

I found out that when this module fails, it hides the real reason for failure.

This patch replaces the generic error with more meaningful diagnostics.

* elasticsearch_plugin - Show STDERR on module failures. Changelog fragment

 samdoran commented 2 days ago

This looks good. Please create a changelog fragment to go along with this change. See fragments for examples.
2018-06-29 17:28:17 -04:00
Sloane Hertel
22a6927dbd Fix file module with check_mode - Fixes #42111 (#42115)
* Fix file module check_mode
2018-06-29 11:19:34 -07:00
Lukas Beumer
26abdbf0fd Add the possiblity to force a plugin installation (#41688) 2018-06-27 12:36:51 -04:00
Jordan Borean
77526a5036
win_domain: fix typo in cmdlet call (#41993) 2018-06-27 11:29:45 +10:00
Jordan Borean
2af36412f9
runas + async - get working on older hosts (#41772)
* runas + async - get working on older hosts

* fixed up sanity issues

* Moved first task to end of test for CI race issues

* Minor change to async test to be more stable, change to runas become to not touch the disk

* moved async test back to normal spot
2018-06-26 14:40:49 +10:00
Jordan Borean
abfcc35e6f
win_iis_webapppool: do not output some cmdlet outputs (#41884) 2018-06-26 11:19:09 +10:00
Jordan Borean
9b7b564d75
Stop displaying kinit pass input on a failure (#41882)
* Stop displaying kinit pass input on a failure

* Fixed up minor logic info and added tests
2018-06-26 05:49:19 +10:00
Andrew Gaffney
9c5d40ff15
Merge various stdout callback plugins into 'default' (#41058)
This allows mixing and matching of stdout callback features
2018-06-24 23:00:07 -05:00
Jordan Borean
2e46688bca
win_chocolatey: always return the rc return value (#41883) 2018-06-25 08:23:31 +10:00
Olivier Bourdon
06b73ff8f1 Add random_mac string filter (#39775)
Add new filter to generate random MAC addresses from
string prefix. See docs/docsite/rst/user_guide/playbooks_filters.rst
for more detailed infos.
2018-06-21 15:56:54 -05:00
Toshio Kuratomi
3ea936312a Remove an unnecessary import from the ansiballz wrapper (#41747) 2018-06-21 12:04:55 +10:00
Jordan Borean
11bd3fd318 win_updates fix when win_updates is run with async (#41756) 2018-06-20 14:52:24 -07:00
Toshio Kuratomi
8bd245a6a2 Fix file state=touch not returning diff information
Fixes #41755
2018-06-20 14:51:27 -07:00
Toshio Kuratomi
ad8142fc6d Add changelog for gce_net sort fix
https://github.com/ansible/ansible/pull/41567
2018-06-16 13:10:23 -07:00
Abhijeet Kasurde
eb2b9b3636 Remove extra line in file_attributes.yaml
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-14 09:56:36 -07:00
Toshio Kuratomi
5814b90835 Add changelog fragment for +/- attribute handling 2018-06-14 06:35:09 -07:00
Toshio Kuratomi
5fdd101a3e Add changelog entry for the no_log fix 2018-06-12 10:25:30 -07:00
Sloane Hertel
40d2df0ef3 Add AWS boto3 error code exception function is_boto3_error_code (#41202)
* Add aws/core.py function to check for specific AWS error codes

* Use sys.exc_info to get exception object if it isn't passed in

* Allow catching exceptions with is_boto3_error_code

* Replace from_code with is_boto3_error_code

* Return a type that will never be raised to support stricter type comparisons in Python 3+

* Use is_boto3_error_code in aws_eks_cluster

* Add duplicate-except to ignores when using is_boto3_error_code

* Add is_boto3_error_code to module development guideline docs
2018-06-12 12:15:16 -04:00
Stéphane Parunakian
8a0a787405 Add backup option to passwordstore lookup (and improve doc) (#39676)
* Add backup option in passwordstore lookup

* Update passwordstore lookup documentation

* Add precision regarding backup param

* Fix empty line added at EOF

* Add version_added attribute for backup option

* Switch examples to multi-line YAML

* Fix documentation for overwrite option

* Add changelog fragment for passwordstore lookup

* Update version added for new feature to 2.7


Co-authored by: Stéphane Parunakian <stephane.parunakian@smile.fr>
2018-06-08 10:33:53 -04:00
Hideki Saito
d7df072b96 Add syslog_facility parameter handling with systemd.journal (#41078)
* Add syslog_facility parameter handling with systemd.journal

- Fixed issue #41072

Signed-off-by: Hideki Saito <saito@fgrep.org>
2018-06-07 12:23:13 -07:00
Sloane Hertel
89cea78e30 Fix async for aws_s3 - fixes #40281 (#40826)
* Fix async for aws_s3

* Add a test that async is able to be used on aws_s3 tasks
2018-06-07 15:09:22 -04:00
Christian Groschupp
e59742eccd [aws] Remove walrus conditional in aws_s3 module when using custom s3_url (#36832)
fix aws_s3 module to use custum s3_url.
2018-06-07 15:07:52 -04:00
Sloane Hertel
387c37e255 aws_s3: don't decrypt file before uploading - fixes #39287 (#39634)
* aws_s3: do not decrypt file before uploading to bucket

* changelog
2018-06-06 16:16:16 -04:00
Abhijit Menon-Sen
276358c885
Introduce inventory.any_unparsed_is_failed configuration setting (#41171)
In the process of building up the inventory by parsing each inventory
source with each available inventory plugin, there are three kinds of
possible errors (listed in order from earliest to latest):

1. One source could not be parsed by a particular plugin.
2. One source could not be parsed by any available plugin.
3. ALL sources could not be parsed by any available plugin.

The errors in (1) are a part of normal operation, e.g., the script
plugin is expected to fail to parse an ini-format source, and we will
ignore that error and try the next plugin. There is currently no way to
control this, and no known compelling use-case for a setting to control
it. This commit does not make any changes here.

We implement "any_unparsed_is_failed" to handle (2) above. If enabled,
this requires that every available source be parsed validly by at least
one plugin. In an inventory comprising a static hosts file and ec2.py,
this setting will cause a fatal error if ec2.py fails (a situation that
attracted only a warning earlier).

We clarify that the existing "unparsed_is_failed=true" setting causes a
fatal error only in (3) above, i.e., if NO inventory source could be
parsed. In other words, if there is ANY valid source in the inventory
(e.g., an ini-format static file), no combination of errors and the
setting will cause a fatal error.

If you want to execute your playbooks when your inventory is…

    (a) complete, use "any_unparsed_is_failed=true".
    (b) not empty, use "unparsed_is_failed=true".

The "unparsed_is_failed" setting should be renamed to
"all_unparsed_is_failed", but this commit does not do so.

Fixes #40512
Fixes #40996
2018-06-06 09:28:58 +05:30
Matt Clay
70c475da6c Implement new changelog generator. 2018-06-05 19:08:15 -07:00