Commit graph

234 commits

Author SHA1 Message Date
Matt Martz
b54086ef02
Merge doc fragments in earlier (#52193)
* Merge doc fragments in earlier

* Move it even higher

* Remove errant docs key

* Fix type
2019-02-19 09:02:12 -06:00
Dag Wieers
8c74df5e67
validate-modules: Fix all system modules (#52384)
This PR includes validate-modules fixes for all system modules.
Except a few that are deliberately implemented like this.
2019-02-19 15:42:14 +01:00
Matt Martz
60255efc32
Don't error on type changes, cast to string and compare (#52505) 2019-02-18 13:25:58 -06:00
Alex Stephen
6ae04017d8 GCE deprecation warning (#52116)
* GCE deprecation warning

* porting guide typo

* fixing ignores

* moving error code back

* underscore marking on gce

* forgot to change status
2019-02-18 16:42:19 +00:00
Dag Wieers
d3bebb661c validate-modules: Harmonize error messages (#52385)
When fixing known errors, the error messages did not make it easy to
find what parameter was having issues (because it was not in the errpr).

Now it consistently starts with the parameter name, and then shows first
the argspec and then the documentation values.

This helps quick assessments.
2019-02-18 09:38:14 -06:00
Felix Fontein
ef3d86255d docker_* modules: remove from validate-modules ignore list (#52402)
* Remove docker_* modules from validate-modules ignore list.

* Adjust types of cacert_path, cert_path and key_path.

* Fix type of update_failure_action in docker_swarm_service.
2019-02-16 07:14:29 -08:00
Abhijeet Kasurde
e0d8d9c2bf validate-modules: Documentation bool (#50085)
* validate-modules: Documentation bool

This check allows to catch cases where type of argument is different than documentation does.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Wrong comparison for 'str'

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Add ignore.txt

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Fix logic and clean up ignore.txt
2019-02-15 14:27:52 -08:00
Dag Wieers
677c04c01d
Sanity fixes to parameter types (#52325) 2019-02-15 16:58:58 +01:00
Dag Wieers
203caf2570
Fix module issues (#52209) 2019-02-15 12:57:20 +01:00
Dag Wieers
cedd9d9926
crypto: Fix known issues in modules (#52302)
* crypto: Fix known issues in modules

This fixes a few issues reported by 'validate-modules'.

* Fix whitespace
2019-02-15 11:46:44 +01:00
Dag Wieers
27dfdb6a6a doc_fragments: Clean up parameter types (database) (#52178)
* module_utils: Clean up parameter types (database)

This PR includes:

- Parameter types added
- Copyright format fixes
- Short license statement
- Description fixes (only for a few files, then I stopped :-))

* Fix validate-modules test ignores
2019-02-15 08:32:45 +00:00
Dag Wieers
cd9471ef17 Introduce new 'required_by' argument_spec option (#28662)
* Introduce new "required_by' argument_spec option

This PR introduces a new **required_by** argument_spec option which allows you to say *"if parameter A is set, parameter B and C are required as well"*.

- The difference with **required_if** is that it can only add dependencies if a parameter is set to a specific value, not when it is just defined.
- The difference with **required_together** is that it has a commutative property, so: *"Parameter A and B are required together, if one of them has been defined"*.

As an example, we need this for the complex options that the xml module provides. One of the issues we often see is that users are not using the correct combination of options, and then are surprised that the module does not perform the requested action(s).

This would be solved by adding the correct dependencies, and mutual exclusives. For us this is important to get this shipped together with the new xml module in Ansible v2.4. (This is related to bugfix https://github.com/ansible/ansible/pull/28657)

```python
    module = AnsibleModule(
        argument_spec=dict(
            path=dict(type='path', aliases=['dest', 'file']),
            xmlstring=dict(type='str'),
            xpath=dict(type='str'),
            namespaces=dict(type='dict', default={}),
            state=dict(type='str', default='present', choices=['absent',
'present'], aliases=['ensure']),
            value=dict(type='raw'),
            attribute=dict(type='raw'),
            add_children=dict(type='list'),
            set_children=dict(type='list'),
            count=dict(type='bool', default=False),
            print_match=dict(type='bool', default=False),
            pretty_print=dict(type='bool', default=False),
            content=dict(type='str', choices=['attribute', 'text']),
            input_type=dict(type='str', default='yaml', choices=['xml',
'yaml']),
            backup=dict(type='bool', default=False),
        ),
        supports_check_mode=True,
        required_by=dict(
            add_children=['xpath'],
            attribute=['value', 'xpath'],
            content=['xpath'],
            set_children=['xpath'],
            value=['xpath'],
        ),
        required_if=[
            ['count', True, ['xpath']],
            ['print_match', True, ['xpath']],
        ],
        required_one_of=[
            ['path', 'xmlstring'],
            ['add_children', 'content', 'count', 'pretty_print', 'print_match', 'set_children', 'value'],
        ],
        mutually_exclusive=[
            ['add_children', 'content', 'count', 'print_match','set_children', 'value'],
            ['path', 'xmlstring'],
        ],
    )
```

* Rebase and fix conflict

* Add modules that use required_by functionality

* Update required_by schema

* Fix rebase issue
2019-02-15 10:57:45 +10:00
Matt Clay
6cba471958 Remove unnecessary validate-modules ignore entry. 2019-02-11 11:12:41 -08:00
Mariusz Mazur
34671a64b3 k8s_auth: new k8s module for handling auth (#50807)
* k8s*: add a reference to k8s_auth in all the modules' descriptions

* k8s_auth: new k8s module for handling auth

* k8s_auth: ignore E203

Can't use module_utils.urls, since that lacks user CA support, which is
a critical feature of what this module does.
2019-02-11 07:55:34 -05:00
Guillaume Martinez
959939b866 Refactor gitlab modules (#51141)
* gitlab_group: refactor module

* gitlab_user: refactor module

* gitlab_group, gitlab_user; pylint

* gitlab_project: refactor module

* gitlab_group, gitlab_project, gitlab_user: Enchance modules

- Add generic loop to update object
- Enchance return messages
- PyLint

* gitlab_runner: refactor module

* gitlab_hooks: refactor module

* gitlab_deploy_key: refactor module

* gitlab_group: enchance module and documentation

- Enchange function arguments
- Add check_mode break
- Rewrite module documentation

* gitlab_hook: enchance module and documentation

- Rewrite documentation
- Enchance function parameters
- Rename functions

* gitlab_project: enchance module and documentation

- Rewrite documentation
- Enchance function parameters
- Add try/except on project creation

* gitlab_runner: enchance module and documentation

- Rewrite documentation
- Fix Copyright
- Enchance function arguments
- Add check_mode break
- Add missing function: deletion

* gitlab_user: enchance module and documentation

- Rewrite documentation
- Enchance function parameters
- Add check_mode break
- Add try/except on user creation

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project,
gitlab_runner, gitlab_user: Fix residual bugs

- Fix Copyright
- Fix result messages
- Add missing check_mode break

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project, gitlab_runner, gitlab_user: pylint

* gitlab_runner: Add substitution function for 'cmp' in python3

* unit-test: remove deprecated gitlab module tests

- gitlab_deploy_key
- gitlab_hooks
- gitlab_project

Actually, they can't be reused because of the modification of the way that the module communicate with the Gitlab instance. It doesn't make direct call to the API, now it use a python library that do the job. So using a pytest mocker to test the module won't work.

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project, gitlab_runner, gitlab_user: add copyright

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project, gitlab_runner, gitlab_user: Support old parameters format

* module_utils Gitlab: Edit copyright

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project,
gitlab_runner, gitlab_user: Unifying module inputs

- Rename verify_ssl into validate_certs to match standards
- Remove unused alias parameters
- Unify parameters type and requirement
- Reorder list order

* gitlab_deploy_key, gitlab_group, gitlab_hooks, gitlab_project, gitlab_runner, gitlab_user: Unifying module outputs

- Use standard output parameter "msg" instead of "return"
- Use snail_case for return values instead of camelCase

* validate-module: remove sanity ignore

* BOTMETA: remove gitlab_* test

- This tests need to be completely rewriten because of the refactoring
of these modules
- TodoList Community Wiki was updated

* gitlab_user: Fix group identifier

* gitlab_project: Fix when group was empty

* gitlab_deploy_key: edit return msg

* module_utils gitlab: fall back to user namespace is project not found

* gitlab modules: Add units tests

* unit test: gitlab module fake current user

* gitlab_user: fix access_level verification

* gitlab unit tests: use decoration instead of with statement

* unit tests: gitlab module skip python 2.6

* unit tests: gitlab module skip library import if python 2.6

* gitlab unit tests: use builtin unittest class

* gitlab unit tests: use custom test class

* unit test: gitlab module lint

* unit tests: move gitlab utils

* unit test: gitlab fix imports

* gitlab_module: edit requirement

python-gitlab library require python >= 2.7

* gitlab_module: add myself as author

* gitlab_modules: add python encoding tag

* gitlab_modules: keep consistency between variable name "validate_certs"

* gitlab_modules: enchance documentation

* gitlab_runner: fix syntax error in documentation

* gitlab_module: use basic_auth module_utils and add deprecation warning

* gitlab_module: documentation corrections

* gitlab_module: python lint

* gitlab_module: deprecate options and aliases for ansible 2.10

* gitlab_group: don't use 'local_action' is documentation example

* gitlab_module: correct return messages

* gitlab_module: use module_util 'missing_required_lib' when python library is missing

* gitlab_module: fix typo in function name.

* gitlab_modules: unify return msg on check_mode

* gitlab_modules: don't use deprecated options in examples
2019-02-07 20:40:14 +01:00
Matt Martz
dfee94dfc7
Validate modules prevent version change (#51549)
* Add logic to catch version changes in docs

* Add in doc fragments before doing doc comparisons

* Handle new module scenario

* historical is only allowed in alreay present modules

* Don't repr StrictVersion
2019-02-07 10:33:50 -06:00
Dennis Lerch
e3006e8443 add diff_mode_enabled to documentation
option 'diff_mode_enabled' is not mentioned in documentation

+label: docsite_pr
2019-02-04 09:06:52 -08:00
Sebastian
48107ac212 junos_config documentation missing "update" choice (#51299)
* Update junos_config.py

The current junos_config module documentation only lists "merge","override" and "replace" as update parameter choices. Looking into junos_python.py "update" is another option which is really helpful and in my opinion the most needed option.

'''
update=dict(default='merge', choices=['merge', 'override', 'replace', 'update'])
'''

+label: docsite_pr

* Fixup Update junos_config.py

The current junos_config module documentation only lists "merge","override" and "replace" as update parameter choices. Looking into junos_python.py "update" is another option which is really helpful and in my opinion the most needed option.

'''
update=dict(default='merge', choices=['merge', 'override', 'replace', 'update'])
'''

Co-Authored-By: crab86 <sgesenhoff@gmail.com>
2019-01-30 10:12:17 -05:00
Daniel Speichert
1a105a99dc hpilo_boot: fix module doc to match code and logic (#51360)
* hpilo_boot: fix module doc to match code and logic

There is no explicit nor implied value for media.
In fact, not choosing media makes perfect sense.

* Remove ignored sanity test failure
2019-01-27 21:17:29 +01:00
Jonathan
20936bbc3d module mongodb_user fix roles default value (#46443) (#46526)
* module mongodb_user fix roles default value (#46443)

* mongodb_user remove ignoring test E324

* mongodb_user add changelog (#464443)

* mongodb_user change doc to set parameter roles as None (#464443)

* mongodb_user fix lint in changelog fragment (#464443)

* mongodb_user : remove E325 exception in test
2019-01-22 15:57:49 -05:00
ABond
d55479d063 DigitalOcean module deprecation (#47272) 2019-01-19 21:25:33 +00:00
Dag Wieers
30227ace98
Fix parameter types and other fixes (#50111)
* Fix parameter types and other fixes

* Fix issues after review

* Fix Windows-references in system/files modules

This PR includes:
- Replacing version/v with just Ansible X.Y
- Removing Windows-alternatives from notes

* Update lib/ansible/modules/system/parted.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/system/service.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/system/service.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Revert type change, move to separate PR

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>

* Update lib/ansible/modules/files/replace.py

Co-Authored-By: dagwieers <dag@wieers.com>
2019-01-18 03:24:47 +01:00
Brian Coca
91d8383898 added missing docs for option in acl module (#50775)
* added missing docs for option in acl module
* remove acl from ignore
2019-01-11 09:49:43 +01:00
Matt Martz
9a520b26e3
Make sure to clean up even if an exception occurs (#50620) 2019-01-08 09:03:49 -06:00
Anil Kumar Muraleedharan
eab3b02cb3 Refactoring of cnos_interface module like what followed by other vendors (#49927)
* Refactoring of cnos_interface module like what followed by other vendors

* To remove cnos-interface from E326 validation ignore list

* Effect of default parameters impacted UT
2018-12-19 11:38:19 -05:00
Matt Clay
97de7c133e Fix no metadata traceback in validate-modules. 2018-12-19 00:39:53 -08:00
Dag Wieers
05c6ff79f9 Convert to reduced list of known types (#50010) 2018-12-19 07:25:30 +10: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
Dag Wieers
15d39f9108 Sanity fixes in various modules (#50080) 2018-12-18 09:53:46 -06:00
Toshio Kuratomi
e09196f760 Fix validate-modules to not complain about sys.exit in comments 2018-12-16 15:03:19 -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
Abhijeet Kasurde
1763c8123b
AWS: Add support for available db types (#48703)
Add several database types which are supported by AWS in valid engine type.

Fixes: #48623

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-05 08:59:36 +05:30
Anil Kumar Muraleedharan
7a81d859c5 Refactoring cnos_vlan in line with ios, eos etc. (#48924)
* Refactoring cnos_vlan in line with ios, eos etc.
2018-11-28 12:51:39 -05:00
Abhijeet Kasurde
bc3e7bbeba
E325 Removal - Part II (#49196)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-11-28 13:55:52 +05:30
Abhijeet Kasurde
9b732df436
E325 removal - Part I (#49136)
Remove E325 from Amazon modules

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-11-27 20:41:01 +05:30
Matt Martz
46b465283c
Fix metadata comparison (#49133) 2018-11-26 10:45:48 -06:00
Matt Martz
7287d396e2 Prevent metadata changes in a stable branch (#48994) 2018-11-26 14:51:39 +00:00
John R Barker
75407d3e43
Validate DOCUMENTATION.author (#48993)
* Validate DOCUMENTATION.author

Ensure that author line includes a GitHub account
2018-11-21 17:29:29 +00:00
Jordan Borean
501acae5ab
Added basic equivalent to PowerShell modules (#44705)
* Added basic equivalent to PowerShell modules

* changes based on latest review

* Added tests

* ignore sanity test due to how tests are set up

* Changes to work with PSCore

* Added documentation and change updated more modules

* Add some speed optimisations to AddType

* fix some issues in the doc changes

* doc changes
2018-11-07 10:53:17 +10:00
Abhijeet Kasurde
57c9532cad OpenStack: add an alias for name (#47972)
This fix adds an additional alias for name parameter viz. subnet

Fixes: #37352

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-11-05 12:56:30 +00:00
René Moser
064530b72e
cs_network_acl_rule: fix doc and sanity (#47835)
* cs_network_acl_rule: fix doc and sanity

* doc styling
2018-11-02 01:08:15 +01:00
Dag Wieers
b7e77c4274 BOTMETA: Move rabbitmq modules to own directory (#46064)
Moving rabbitmq modules to own directory makes it possible to automatically include $team_rabbitmq for new modules.
2018-10-30 14:54:38 -05:00
Matt Clay
8d00afc013 Ignore user module use of subprocess. 2018-10-22 17:42:15 -07:00
Shuang Wang
d302485f99 option [others] of get_url is unnecessary (#47005)
* parameters [others] of get_url is unnecessary

* delete a blank line

* test

* delete ignore

* Update get_url.py
2018-10-15 09:24:48 -05:00
Justin England
0bc5b799a6 Update win_scheduled_task.py (#46720)
* Update win_scheduled_task.py to document that the duration of a task trigger can be null, which will cause it to run indefinitely - docs update makes use of suboptions

* Add a fix for the validate-modules schema
2018-10-11 13:16:25 -05:00
Pilou
955579cd72 rabbitmq_user: 'node' parameter: add default value (#38156)
* Remove unnecessary workaround

* add test: set RABBITMQ_NODENAME environment variable

The following error occurs:

  TASK [rabbitmq_user : Add user] ***
  fatal: [testhost]: FAILED! => {
    "changed": false,
    "cmd": "/usr/sbin/rabbitmqctl -q list_users",
    "rc": 69,
    "msg": "Error:********@c65c2bc59398'. Please see diagnostics information and suggestions below.\n\nMost common reasons for this are:\n\n * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)\n * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)\n * Target node is not running\n\nIn addition to the diagnostics info below:\n\n * See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more\n * Consult server logs on node test@c65c2bc59398\n\nDIAGNOSTICS\n===========\n\nattempted to contact:********@c65c2bc59398\n * effective user's home directory: /var/lib/rabbitmq\n * Erlang cookie hash: 3MxcYFrJzfhEL+FlUfLlQw==",
    "stderr":  [...],
    "stderr_lines": [
      "Error: unable to perform an operation on node 'test@c65c2bc59398'. Please see diagnostics information and suggestions below.", "",
      "Most common reasons for this are:", "",
      " * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)",
      " * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)",
      " * Target node is not running", "",
      "In addition to the diagnostics info below:", "",
      " * See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more",
      " * Consult server logs on node test@c65c2bc59398", "",
          "DIAGNOSTICS", "===========", "",
          "attempted to contact: [test@c65c2bc59398]", "",
          "test@c65c2bc59398:",
      "  * connected to epmd (port 4369) on c65c2bc59398",
      "  * epmd reports: node 'test' not running at all",
      "                  other nodes on c65c2bc59398: [rabbit]",
      "  * suggestion: start the node", "",
      "Current node details:",
      " * node name: rabbitmqcli2@c65c2bc59398",
      " * effective user's home directory: /var/lib/rabbitmq",
      " * Erlang cookie hash: 3MxcYFrJzfhEL+FlUfLlQw==", ""
    ],
    "stdout": "",
    "stdout_lines": []
  }

* node parameter: fix default value

'rabbit' is the default value mentioned in the module documentation.
2018-10-08 18:34:08 -04:00
Sandra McCann
08c392477e made sros_config docs match code for match options (#46135)
* made docs match code for match options

* fixed shippable error
2018-09-26 19:08:26 +05:30
René Moser
7f92a8c94c
cs_staticnat: fix sanity (#46037) 2018-09-26 09:03:16 +02:00
René Moser
c09b785a66
cs_instance: doc: fix typo in examples (#46035) 2018-09-26 09:02:06 +02:00
Matt Martz
86e8d21667
Perform full RETURN schema validation in one step, don't try to loop (#46079) 2018-09-24 16:38:04 -05:00