Commit graph

27660 commits

Author SHA1 Message Date
Matt Clay
80c559bdef Test sftp and scp for ssh connection. 2016-12-14 17:34:03 -08:00
Ryan S. Brown
197658aff4 Handle when the AMI launch permissions are unset.
Use an empty list to avoid a TypeError because `'NoneType' is not iterable``
2016-12-14 19:45:14 -05:00
Michael Gugino
250f862573 Fix bug #5328 apache module loading (#19355)
* Fix bug #5328 apache module loading

Currently, the apache2_module module parses apache configs
for correctness when enabling or disabling apache2 modules.

This behavior introduced a conflict condition when transitioning
between mpm modules, such as mpm_worker and mpm_event.

This change accounts for the specific error condition raised
by ``apachectl -M``:
``AH00534: apache2: Configuration error: No MPM loaded.``
When loading or unloading a module with a name that contains 'mpm_',
apache2_module will ignore the error raised by apachectl if stderr
contains 'AH00534'.

Fixes #5328

* Add AH00534 warning

* Added changes from PR #5629

* Modified ignore_configcheck behavior
2016-12-14 13:18:19 -08:00
Toshio Kuratomi
0b440a9289 Code smell test for iteritems and itervalues (#19292)
* Code smell test for iteritems and itervalues

* Change the keydict object in authorized_keys so it doesn't throw a false postive

keydict is a bad data structure anyway.  We don't use the iteritems and
itervalues methods so just disable them so that the code-smell tests do
not trigger on it.

* Change release templates so they work with py3
2016-12-14 12:16:16 -08:00
Brian Coca
f550b4541f bad/missing fact plugin is a warning (#19350) 2016-12-14 14:25:19 -05:00
John R Barker
739a310382 Formatting (#19353) 2016-12-14 18:26:17 +00:00
Steve Kuznetsov
d5324c11a0 Factored polling std{out,err} reads into a function
The process to poll for data in the stdout and/or stderr pipes during a
low-level command execution was repetitive. Factoring this out into a
function DRYs out the code.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2016-12-14 10:14:31 -08:00
Tim Rupp
362c86d323 Fixes map call usage
For the comparisions that need to be done, this map call needs
to convert to a list because the six import in ansible changes
the behavior of map to return an iterator instead of a list
2016-12-14 10:00:47 -08:00
Ondra Machacek
f84f97d035 cloud: ovirt: Add support to upload/copy/move disks (#19337) 2016-12-14 12:43:25 -05:00
Brian Coca
ed933421fe correct template lookup path
now all paths get 'templates/'
2016-12-14 12:25:08 -05:00
Ryan Brown
60a1e719c8 Move GUIDELINES.md from modules repo (#19313) 2016-12-14 11:46:14 -05:00
Ondra Machacek
5400a06ac4 cloud: ovirt: Various fixes for oVirt modules (#19141)
*  cloud: ovirt: fix various issues in ovirt modules

* cloud: ovirt: add support for nfs version

* cloud: ovirt: Fix facts documentation

* Add proper documentation fragmet
* Add proper argument_spec
* Fix return values

* cloud: ovirt: fix pep8
2016-12-14 11:42:15 -05:00
Robin Roth
afca957396 Fix UnboundLocalError remote_head in git (#19057)
* Fix UnboundLocalError remote_head in git

Fixes #5505

The use of remote_head was a leftover of #4562.
remote_head is not necessary, since the repo is unchanged anyway and
after is set correctly.

Further changes:
* Set changed=True and msg once local_mods are detected and reset.
* Remove need_fetch that is always True (due to previous if) to improve
clarity
* Don't exit early for local_mods but run submodules update and
switch_version

* Add test for git with local modifications
2016-12-14 08:36:15 -08:00
Dag Wieers
8a25b2477c Remove the hint to report module issue elsewhere. 2016-12-14 11:30:44 -05:00
Ondra Machacek
fa96438f4c cloud: ovirt: Add support to list nested entities parameters (#19300) 2016-12-14 11:15:50 -05:00
Andrea Tartaglia
59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
2016-12-14 08:01:45 -08:00
Dag Wieers
7c71c678fa Fix regression in search path behaviour
This PR fixes a few issues:

- Missing role parent directory for relative paths
- Fix integration tests (add missing stage)
- Redesign integration tests
- Incorrect order with tasks-lookups
- Duplicate paths are listed
- Repetitive tasks/tasks or files/files were possible

==== using copy with test.txt
Before:
```
   491 1481281038.29393: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

After:
```
 32505 1481280963.22418: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

==== Using copy with files/test.txt

Before:
```
 31523 1481280499.63052: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

After:
```
 31110 1481280299.38778: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

==== Using template with files/test.txt.j2
Before:
```
 30074 1481280064.15191: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

After:
```
 29201 1481279823.52752: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

This fixes #19048
2016-12-14 10:33:14 -05:00
René Moser
18b7852940 cloudstack: utils: fail friendlier if no zones available (#19332) 2016-12-14 11:37:26 +01:00
Matt Clay
f28b5a0ed8 Add --tox-sitepackages option to ansible-test. 2016-12-13 16:57:23 -08:00
Toshio Kuratomi
dd46cb7b05 Add a code-smell test for iterkeys (#18589)
* Add a code-smell test for iterkeys
* Add a message on how to port iterkeys problems and make the grep more robust
2016-12-13 16:39:03 -08:00
Matt Clay
f789a20f29 Update log download url. 2016-12-13 16:26:10 -08:00
Matt Clay
45772b961f Add private fork CI support to ansible-test. 2016-12-13 15:49:57 -08:00
Toshio Kuratomi
c6b42028c4 Fixes for uri under python3 and local (non-httptester) testing 2016-12-13 15:46:07 -08:00
Matt Clay
dab2bf7e13 Skip test_uri on python 3. 2016-12-13 13:51:57 -08:00
Ken Evensen
6b62b9f48c Adding pamd module for Ansible (#19029) 2016-12-13 15:34:44 -05:00
Adrian Likins
c693ba19f9 unit tests for playbook/conditional.py (#18586)
Start of unit tests for playbook/conditional.py
2016-12-13 14:38:16 -05:00
Adrian Likins
3efef40822 Add unit tests for playbook/helpers.py (#18709) 2016-12-13 14:36:04 -05:00
Adrian Likins
1653a77f1d add unit tests for playbook/included_file.py (#18710) 2016-12-13 14:35:27 -05:00
Adrian Likins
08a5d506bb Fix errors on 'ansible-playbook --flush-cache' (#18754)
Add a unit test, and split out the flush cache logic to
it's own method.
Fixes #18708
2016-12-13 14:35:15 -05:00
Adrian Likins
6c4f554f5a Provide slightly better msg on fact cache error (#18759)
If the configured fact_cache plugin (fact_caching config)
fails, raise a fatal error instead of failing mysteriously
later.

Fixes #18751
2016-12-13 14:34:58 -05:00
Adrian Likins
2979488b08 Allow sphinx to use multiple cpus w -j support (#18900)
'CPUS=6 make webdocs' for example
2016-12-13 14:34:21 -05:00
Carlos E. Garcia
0b8011436d minor spelling changes 2016-12-13 13:51:13 -05:00
Michael Scherer
054a3fccf8 Cleanup import for sysctl module 2016-12-13 13:26:54 -05:00
Michael Scherer
f9460f3c80 Use type='path' instead of 'str' for deploy_helper 2016-12-13 13:25:45 -05:00
Michael Scherer
db8719cf8b Add support for NetBSD
While I only checked on NetBSD 7.0, it seems to use the same
rc system as FreeBSD so it should be working for now.
2016-12-13 13:24:34 -05:00
Michael Scherer
6ffd494efb Cleanup imports for user
Some class use shutil, who was not imported, and we want to
avoid '*' for future refactoring.
2016-12-13 11:53:18 -05:00
Lumír 'Frenzy' Balhar
84544ee8fd Fix AST nodes for Python 3 and enable dependent test_uri (#18597)
* Enable tests on python 3 for uri

* Added one more node type to SAFE_NODES into safe_eval module.

ast.USub represents unary operators. This is necessary for
parsing some unusual but still valid JSON files during testing
with Python 3.
2016-12-13 07:37:39 -08:00
John R Barker
b915e790d3 veos-dut-01 is down, so use veos01 (#19299) 2016-12-13 14:40:52 +00:00
Ondra Machacek
95ef9fd9f9 cloud: ovirt: Add ovirt_tags and ovirt_tags_facts modules (#19295) 2016-12-13 09:14:09 -05:00
Toshio Kuratomi
51491c9904 Remove itervalues (not available on py3) 2016-12-13 05:40:48 -08:00
Toshio Kuratomi
a8af6c6baf Fix some SSL errors in mail.py causing SMTP Syntax Errors (Rebase of https://github.com/ansible/ansible-modules-extras/pull/708 ) (#19253)
* Rebase of https://github.com/ansible/ansible-modules-extras/pull/708

708 was full of extraneous merge commits interwoven with commits to
implement the feature. In the end the only way I could clean this up
in reasonable time was to just take a regular diff between the PR and
the base.  This lost the history of intermediate commits but I've
preserved attribution to @dayton967 via git's --author field.

Although I preserved the logic of the PR, there were a few additional
things that I cleaned up:

* Fixed import of email.mime.multipart
* Used the argspec to set port and timeout to integers instead of having
  ad hoc code inside of the module.
* Used argspec's choices for secure instead of ad hoc code inside of the
  module.
* Removed some unused variables
* Made secure_state a python boolean instead of using 0 and 1
* Used secure with string comparisons instead of turning it into an
  integer code.  This is much more readable.
* Fixed catching of SMTPExceptions (SMTPException wasn't imported
  directly so it needed to use the smtplib namespace.)
2016-12-13 04:28:24 -08:00
John R Barker
bdc4fa6b99 Add group_vars/ops.yaml (#19288)
Authentication details for ops modules. Was missed during porting
2016-12-13 11:54:51 +00:00
René Moser
a28d898c29 cloudstack: cs_securitygroup_rule: fix impossible to set icmp_code and icmp_type to 0 (#19258) 2016-12-13 06:58:17 +01:00
Andrea Tartaglia
ef391a11ec Removed dict.iteritems() in modules. (#18859)
This is for py3 compatibility, addressed in #18506
2016-12-12 15:16:23 -08:00
Vlad Glagolev
4b27d08643 dropped 'BOOLEANS' choices, converted env vars to str 2016-12-12 14:25:19 -08:00
Robin Roth
5bf07454cb Test apache2 force (#18500)
* Use native yaml for apache2 test

* Test removal of default modules with force

a2enmod on debian has `-f`, but not on SUSE (runs there without force).
Therefore don't test that option on SUSE.
The docs already specify that the option is intended for Debian systems
only.
2016-12-12 14:19:47 -08:00
Clark Boylan
a65e34ce77 Fix synchronize retries (#18535)
* Fix synchronize retries

The synchronize module munges its task args on every invocation of
run(). This was problematic because the munged data was not fit for use
by a second pass of the synchronize module. Correct this by using a copy
of the task args on every invocation of run() so that the original args
are not affected.

Local testing using this playbook seems to confirm that things work as
expected:

  - hosts: all
  tasks:
    - delay: 2
      register: task_result
      retries: 1
      until: task_result.rc == 0
      synchronize:
        dest: /tmp/out
        mode: pull
        src: /tmp/nonexistent/

fixes #18281

* Update synchroncization fixture assertions

When we started operating on a copy of the task args the test assertions
were no longer asserting things about the munged state but of the
pristine state. Convert the copy of task args to a class member so that
it can be compared against later in testing and update the assertions to
check this munged copy.
* Shuffle objects around for cleaner testing

Attach the temporary args dict to the task rather than the action as
this makes updating the existing tests cleaner.
2016-12-12 13:33:30 -08:00
ikelos
9e5d4de49a Fix overwrite parameter in module_utils.junos (#18671)
The overwrite parameter is forcibly set to false, meaning a module
passing that parameter will have no effect.  The overwrite facility
is necessary to ensure that conflicting options can be written the
configuration (which, in replace mode, they cannot).

This change ensures that if overwrite is set, it will not be changed
to False in the logic.
2016-12-12 15:57:29 -05:00
Patrick Ogenstad
05e5474c52 Disable CLI errors when typing enable (#18531) 2016-12-12 15:55:22 -05:00
Juan Antonio Valiño García
40ddbe026d Fixes #18663. Bad handling of existing config in dellos9 module. (#18664)
* Fixes #18663. Bad handling of existing config in dellos9 module.

The dellos9 module doesn't build correctly the internal
structures used to represent the existing config of the managed
network device. This leads to apply changes every time the
playbook is run, even if the existing config is the same that the
one you are trying to push into the device.

Probably this problem exist also in the dellos6 and dellos10
modules, but I only fixed it in the dellos9 module.

The fix modifies two methods. The first one is `get_config`,
where the return clause didn't work correctly when the flow
doesn't enter in the `if` block. In that case the `contents`
variable is not an array an this should be handled.

The second fix is in the `get_sublevel_config` method. In this
case the indentation whitespaces of the parents should be rebuild
because further functions and methods required it to handle
correctly comparisons used to check if changes should be pushed
into device.

* Fixes #18663 for dellos10 module with the same patches as dellos9.
2016-12-12 15:51:32 -05:00