Commit graph

6623 commits

Author SHA1 Message Date
Wojciech Wypior
f761cc4077 added ASM policy server technology module (#50116)
* added ASM policy server technology module

* Update bigip_asm_policy_server_technology.py
2018-12-18 18:38:19 -08:00
Toshio Kuratomi
bd072fe83a
Make the timeout decorator raise an exception out of the function's scope (#49921)
* Revert "allow caller to deal with timeout (#49449)"

This reverts commit 63279823a7.

Flawed on many levels

* Adds poor API to a public function
* Papers over the fact that the public function is doing something bad
  by catching exceptions it cannot handle in the first place
* Papers over the real cause of the issue which is a bug in the timeout
  decorator
* Doesn't reraise properly
* Catches the wrong exception

Fixes #49824
Fixes #49817

* Make the timeout decorator properly raise an exception outside of the function's scope

signal handlers which raise exceptions will never work well because the
exception can be raised anywhere in the called code.  This leads to
exception race conditions where the exceptions could end up being
hanlded by unintended pieces of the called code.

The timeout decorator was using just that idiom.  It was especially bad
because the decorator syntactically occurs outside of the called code
but because of the signal handler, the exception was being raised inside
of the called code.

This change uses a thread instead of a signal to manage the timeout in
parallel to the execution of the decorated function.  Since raising of
the exception happens inside of the decorator, now, instead of inside of
a signal handler, the timeout exception is raised from outside of the
called code as expected which makes reasoning about where exceptions are
to be expected intuitive again.

Fixes #43884

* Add a common case test.

Adding an integration test driven from our unittests.  Most of the time
we'll timeout in run_command which is running things in a subprocess.
Create a test for that specific case in case anything funky comes up
between threading and execve.

* Don't use OSError-based TimeoutError as a base class

Unlike most standard exceptions, OSError has a specific parameter list
with specific meanings.  Instead follow the example of other stdlib
functions, concurrent.futures and multiprocessing and define a separate
TimeoutException.

* Add comment and docstring to point out that this is not hte Python3 TimeoutError
2018-12-18 18:01:46 -08:00
Dag Wieers
05c6ff79f9 Convert to reduced list of known types (#50010) 2018-12-19 07:25:30 +10:00
Yannig Perré
6b41588e93 Fix with_ini example and unittest
* Fix example in ini.py
* Fix unittest in test_ini.py to pass CI as latest ansible returns list in
  different order. To prevent such issues in future results are sorted
* PEP8 E501 styling improvements

Co-Authored-By: Sergii Golovatiuk <sgolovat@redhat.com>
2018-12-18 12:25:02 -08:00
Abhijeet Kasurde
139e3477a7 Review comments
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-18 12:20:35 -08:00
Abhijeet Kasurde
44bd8fc0a8 Update unit tests for configmanager
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-18 12:20:35 -08:00
Dag Wieers
7fb1a71a2c
no-smart-quotes: Skip files by path in code-smell (#45881)
* no-smart-quotes: Skip files by path in code-smell

This is to ensure the generated docs do not trigger code-smell issues on
contributor systems.

* Implement feedback from review
2018-12-18 20:33:18 +01:00
Matt Martz
6025990fe9
Remove the use of mock from validate-modules (#50098)
* Remove the use of mock from validate-modules

* Monkeypatch AnsibleModule.__init__ not AnsibleModule
2018-12-18 11:44:17 -06:00
Brian Coca
88c87a3583
added handlers_from (#49220)
* added handlers_from

fixes #46769
2018-12-18 11:28:24 -05:00
Dag Wieers
15d39f9108 Sanity fixes in various modules (#50080) 2018-12-18 09:53:46 -06:00
rajaspachipulusu17
d28e700a22 Pluribus networks admin session timeout module with unit tests (#50012)
* Pluribus networks admin session timeout module with unit tests
* Doc fix
* Removed unused imports
* Removed unwanted global variable
2018-12-18 17:23:45 +05:30
Christian Kotte
f123f894df Improve module vmware_local_role_manager (#47870)
* add check mode support
* improve output
2018-12-18 17:10:10 +05:30
Christian Kotte
e65b721283 VMware: new module vmware_host_ad_auth (#47901) 2018-12-18 16:34:11 +05:30
Christian Kotte
f431e5b0e2 VMware: new module vmware_dvswitch_uplink_pg (#48846) 2018-12-18 16:14:18 +05:30
Felix Fontein
92ef500185 openssl_privatekey: add ECC support (#49416)
* Add cryptography backend for openssl_privatekey.

* Adding ECC support.

No support for X25519 and X449, since they don't support serialization.

* Improve finterprint calculation to work with Python 3.

* Add fingerprint check.

* Fix typo.

* Use separate curve option for elliptic curves, and use type 'ECC'.

* Using curve names as defined in IANA registry.

* Bump minimal supported cryptography version. Older versions might work as well, but I couldn't test them.

* Improve documentation.
2018-12-18 09:07:36 +00:00
rajaspachipulusu17
cf00880ab3 Pluribus Networks dscp map module with unit tests (#49849)
* Pluribus Networks dscp map module with unit tests
* Doc string fix
2018-12-18 12:50:16 +05:30
rajaspachipulusu17
4d88cdd83a Pluribus Networks cpu class module with unit tests (#49847)
* Pluribus Networks cpu class module with unit tests
* Doc string fixes
2018-12-18 12:42:33 +05:30
Matt Clay
61b5adcf31 Add OverlayFS work-around for CloudStack tests. 2018-12-17 15:45:31 -08:00
Jérémy Lecour
2fb9b46752 Lineinfile must not insert lines multiples times with insertbefore/insertafter (#49409)
* Change test suite to fit expected behaviour

This reverts some changes from ansible/ansible@723daf3
If a line is found in the file, exactly or via regexp matching, it must 
not be added again.
insertafter/insertbefore options are used only when a line is to be 
inserted, to specify where it must be added.

* Implement the change in behaviour mentioned in the previous commit

* Fix comment to reflect what the code does

* Set the correct return message.

In these cases, the lines are added, not replaced.

* Add a changelog
2018-12-17 16:42:24 -05:00
Matt Martz
7eb1ab45a7
Allow tags to be templated from a variable (#49833)
* Allow tags to be templated from a variable. Fixes #49825

* Restore _load_tags to ensure we do csv tag splitting

* Add tests for csv tags and templated tags

* evaluate_tags doesn't need to accept strings, because _load_tags handles this
2018-12-17 15:40:26 -06:00
Matt Clay
0ccd231afd
Fix MySQL tests when running under Docker. (#50047) 2018-12-17 12:59:40 -08:00
Toshio Kuratomi
61b1daa65f Port from plaform.dist to ansible.module_utils.distro.linux_distribution
ci_complete
2018-12-17 11:01:01 -08:00
Adrian Likins
be65d9cfe5 Skip sanity tests that don't apply to bundled code
* add distro to pep8 skip tests
* Skip no-assert test for distro
* Add bundled distro to the empty-init skip list
2018-12-17 11:01:01 -08:00
Adrian Likins
e872811b8d WIP: add tests to compare to platform.*dist
Can be removed once everything is ported.
2018-12-17 11:01:01 -08:00
Adrian Likins
5e1f8a48f3 Bundle a copy of github.com/nir0s/distro/distro.py
Since the 'platform.dist()' and 'platform.linux_distribution()'
methods will be removed from future versions of python, this
provides an alternative to replace ansibles use of those
methods.

lib/ansible/module_utils/distro.py is a copy of
https://github.com/nir0s/distro/blob/master/distro.py

This module is originally from https://github.com/nir0s/distro
and is license under the Apache License, Version 2.0.
2018-12-17 11:01:01 -08:00
f-bor
134c1a624e new network module: edgeswitch_vlan (#48041)
* initial commit

* better commands generation
2018-12-17 11:30:17 +05:30
anasbadaha
369354547e Issue: 46475 Fix onyx magp module for supporting new json format (#49417)
Signed-off-by: Anas Badaha <anasb@mellanox.com>
2018-12-17 10:52:51 +05:30
Zim Kalinowski
de3d188cdd
support lro in azure_rm_resource (#49919) 2018-12-17 13:21:25 +08:00
Toshio Kuratomi
e09196f760 Fix validate-modules to not complain about sys.exit in comments 2018-12-16 15:03:19 -08:00
Toshio Kuratomi
175f3b51e5 Ensure that current uses of BaseException are required
* In some cases, it appears that Exception should have been used instead
  as there's no need to catch sys.exit KeyboardInterrupt and similar.
* In a few cases, it appears that BaseException is used because
  a library we depend on calls sys.exit() contrary to good coding
  design.  Comment those so that we know that those have been audited
  and found to be correct and change to use (Exception, SystemExit)
  instead.
2018-12-16 15:03:19 -08:00
Toshio Kuratomi
3fba006207 Update bare exceptions to specify Exception.
This will keep us from accidentally catching program-exiting exceptions
like KeyboardInterupt and SystemExit.
2018-12-16 15:03:19 -08:00
Toshio Kuratomi
5147e792d3 Enable the bare-except pylint and pep8 checking 2018-12-16 15:03:19 -08:00
anasbadaha
c0dbc1a441 Issue/38837 (#49873)
* Fix Issue #38837

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Issue #38837 2

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Enhance decumentation

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Failures in Shippable

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Version Added

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Add version_added:2.8 in purge attributes

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2018-12-16 13:16:28 +05:30
Abhijeet Kasurde
162d9497ba
Ad-hoc command: fix 'any' call in play_ds (#49852)
* Ad-hoc command: fix 'any' call in play_ds
* Unit test for ad-hoc cli
* Review comments

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-16 11:07:06 +05:30
Dave Bendit
d62d7176b0 [docker_container] Failing on non-string env values (#49843)
* [docker_container] Failing on non-string env values

Fixes #49802

* Clarify failure message

Co-Authored-By: DBendit <David@ibendit.com>

* Fixup from review
2018-12-14 13:21:54 -06:00
Abhijeet Kasurde
013c42b14f
Misc typo fixes (#49816)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-14 15:12:58 +05:30
Yuwei Zhou
7609a8cdd6 support overprovision in azure_rm_vmss (#49806) 2018-12-14 16:48:40 +08:00
Jordan Borean
4019d4f6d1
Windows Privileges - moved util code to it's own C# util (#48897)
* Windows Privileges - moved util code to it's own C# util

* Rename Enabler class to PrivilegeEnabler to remove ambiguity

* rename Utils to PrivilegeUtil

* fix missing util name changes
2018-12-14 12:00:46 +10:00
Jordan Borean
695feea541
ansible-test: do not upgrade homebrew to speed up tests (#49914) 2018-12-14 10:46:16 +10:00
Susant Sahani
59dcf3f277 nmcli: Introduce SIT Tunnel (#45937)
This work enables to add sit tunnel via nmcli module

Signed-off-by: Susant Sahani susant@redhat.com

SUMMARY
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
nmcli

ANSIBLE VERSION
2.8
ADDITIONAL INFORMATION
  - nmcli:
       state: present
       type: sit
       conn_name: sit_test1
       autoconnect: yes
       ip_tunnel_dev: enp0s8
       ip_tunnel_local: 192.168.1.2
       ip_tunnel_remote: 192.168.1.5
2018-12-12 23:06:09 -05:00
Jordan Borean
190d1ed7f1 win become: refactor and add support for passwordless become (#48082)
* win become: refactor and add support for passwordless become

* make tests more stable

* fix up dep message for Load-CommandUtils

* Add further check for System impersonation token

* re-add support for become with accounts that have no password

* doc fixes and slight code improvements

* fix doc sanity issue
2018-12-12 17:15:25 -08:00
Dag Wieers
baf0ad2309 Docs: Add a "seealso" section to the module docs (#45949)
* Docs: Add a separate  "seealso" section to the module docs
to list related modules and/or related references. This clears up the notes
section for things that are actual notes.

So you can add a section in your module documentation and four types of
references are possible.

    seealso:

    # Reference by module name
    - module: aci_tenant

    # Reference by module name, including description
    - module: aci_tenant
      description: ACI module to create tenants on a Cisco ACI fabric.

    # Reference by rST documentation anchor
    - ref: aci_guide
      description: Detailed information on how to manage your ACI infrastructure using Ansible.

    # Reference by Internet resource
    - name: APIC Management Information Model reference
      description: Complete reference of the APIC object model.
      link: https://developer.cisco.com/docs/apic-mim-ref/

This PR also includes:

- Implements ansible-doc support
- Implements schema support for the seealso options
- Updates to the development documentation
- Rename filter convert_symbols_to_format to rst_ify, cfr the existing html_ify and tty_ify filters
  - This makes the existing template a lot easier to read and fixes the confusion I had myself rereading the template (again).
- We fixed the possible suboption types (which was limited to 'bool' only)

* Use latest stable instead of devel docs
2018-12-12 14:19:58 -06:00
cma0
974c45a5f5 itential iap_token module (#46773) 2018-12-12 14:28:20 -05:00
Nilashish Chakraborty
d729614d72
Add support for hashed password (#49464)
* Add support for hashed password

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Fix Shippable errors

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Make pwd options mutually exclusive

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
2018-12-12 22:22:15 +05:30
WhyIsThisOpen
7bdca72713 rhn_register fixes for username and password when unregistering
- Require username and password for unregistering and avoid "cannot marshal None unless allow_none is enabled" error when using an activation key and no channels specified.
- Update test fixtures and add changelog


Co-authored-by: WhyIsThisOpen <WhyIsThisOpen@users.noreply.github.com>
2018-12-12 11:32:48 -05:00
Mike Wiebe
0e4a7b0889 Fix nxos_reload timeout and add integration tests (#49632)
* Fix timeout and add tests

* Correct module name
2018-12-12 10:32:27 -05:00
rajaspachipulusu17
b47cde9d4c Pluribus Networks pn access list ip module with unit test cases (#49604)
* Pluribus Networks pn access list ip module with unit test cases

* Changes according to ansibot standards in unit test modules

* Remove unwanted variables

* Removed unwanted super call
2018-12-12 13:33:01 +00:00
Chris Archibald
8ad5035ce6 Bug Fix and rewrite (#49508) 2018-12-12 12:16:12 +00:00
Christian Kotte
1b9b0b85c4 new module vmware_dvswitch_pvlans (#48855) 2018-12-12 09:13:54 +00:00
Dave Bendit
8fcf9e1a28 [docker_container] Fixes idempotency checks for network_mode (#49797)
Fixes #49794
2018-12-12 09:04:24 +00:00