Commit graph

990 commits

Author SHA1 Message Date
Jordan Borean
8e92cca139
win_credential: new module to manage credentials (#48840)
* win_credential_manager: new module to manage credentials

* fix sanity issues and removed CredSSP references

* renamed module to win_credential

* fix typo on test variable

* fix sanity ignore line
2018-11-22 06:55:48 +10: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
John R Barker
e7da4975cc
Botmeta validate path macros (#48980)
BOTMETA validation - use path macros

Rather than hard coding the list of path macros, read them directly from
BOTMETA
2018-11-21 11:15:56 +00:00
Matt Martz
9773a1f289
Add a Singleton metaclass, use it with Display (#48935)
* Add a Singleton class, use it with Display

* update six import

* Move remaining failes to display singleton

* Fix rebase issues

* Singleton improvements

* Add code-smell for 'from __main__ import display'. ci_complete

* s/self/cls/g

* Add docs for no-main-display

* Address linting issues

* Add changelog fragment. ci_complete

* Implement reentrant lock for class instantiation in Singleton

* Add Display singleton porting guide
2018-11-20 17:06:51 -06:00
Dag Wieers
f69e3e1cec win_get_url: Rewrite using AnsibleModule (#48390)
* win_get_url: Rewrite using AnsibleModule

* Fix sanity issue

* Implemented review suggestions

* Try something else

* fix circular dependency issues
2018-11-19 08:17:13 +10:00
Matt Clay
1a3bf09f8a
Add test to require docs for action plugins. (#48376) 2018-11-13 22:52:36 -08:00
Matt Martz
8765d2a8e8
code-smell test that can find deprecated config items (#46273)
* Start of code-smell test that can find deprecated config items

* Strip deprecated.version from config item

* Don't use os.walk, rely on explictly passed list of files

* Properly disable the test

* Add docs

* Make config an orphan
2018-11-13 09:29:39 -06: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
Brandon Bell
5568ffd45b Fix syntax error for Python 2.6 (#47635)
* Fix syntax error for Python 2.6

* Removing consul.py from pylint/ignore.txt
2018-10-27 12:43:53 +10:00
Matt Clay
8d00afc013 Ignore user module use of subprocess. 2018-10-22 17:42:15 -07:00
Matt Clay
c24c19594e
Enable pylint rules and fix exposed bugs. (#47219)
* Resolve invalid-unary-operand-type.

* Resolve raising-format-tuple.

* Resolve stop-iteration-return.

* Use disable comment instead of fixing logic.

The affected line in _find_address_range will only fail on Python 3.7
and later if the function is called with an empty address list. As an
internal method it is never called in this way, making it a non-issue
for use via public methods.

Using a comment to disable the rule in favor of an ignore.txt entry
since there are no plans to change the logic in the code itself. This
will also prevent any potential future issues being added in other
parts of the code when updating it based on upstream changes.
2018-10-19 08:32:52 -07:00
Matt Clay
37b013aca3
Enable additional pylint rules and resolve issues found. (#47221)
* Resolve unneeded-not.
* Resolve global-at-module-level.
* Resolve useless-import-alias.
* Resolve bad-whitespace.
* Resolve global-variable-not-assigned.
* Resolve logging-not-lazy.
* Resolve comparison-with-itself.
2018-10-18 13:38:08 -07:00
Toshio Kuratomi
bcd6dbcd65 Remove get_exception from the remainder of the modules 2018-10-18 08:37:04 -07:00
Matt Martz
90d2620939 Remove deprecated os_server_actions alias (#47208)
* Remove deprecated os_server_actions alias. Fixes #44991

* Skip os_server_actions
2018-10-18 16:44:44 +10:00
Matt Clay
c3a6737004 Add BOM check to shebang sanity test.
Includes fixes for docsite files with a UTF-8 BOM.
2018-10-15 12:03:58 -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
Matt Clay
76bf861308
Upgrade pylint to version 2.1.1. (#47036)
* Fix issues reported by the latest pylint.
* Split pylint runs into more contexts.
* Upgrade pylint.
2018-10-14 22:59:52 -07:00
Matt Clay
0c29463785 Block module ansible imports outside module_utils. 2018-10-11 19:54:54 -07: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
Alicia Cozine
9764f32513 adds stub API docs in a single file (#46663)
* adds stub API docs in a single file
2018-10-11 10:15:24 -04: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
Matt Clay
a11f631ee4 Python 3.8 collections compatibility fixes.
Includes a new pylint blacklist plugin to prevent regressions.
2018-10-08 11:26:37 -07:00
Felix Fontein
a520ca3298 docker_container, docker_image_facts: allow to use image IDs (#46324)
* Allow to specify images by hash for docker_container and docker_image_facts.

* flake8

* More sanity checks.

* Added changelog.

* Added test.

* Make compatible with Python < 3.4.

* Remove out-commented imports.
2018-10-06 08:50:31 -05:00
Matt Clay
e2b6047514
Add symlinks sanity test. (#46467)
* Add symlinks sanity test.
* Replace legacy test symlinks with actual content.
* Remove dir symlink from template_jinja2_latest.
* Update import test to use generated library dir.
* Fix copy test symlink setup.
2018-10-04 07:02:42 -07:00
Jordan Borean
ba638f40cf
ps-lint: ignore rules that are not relevant to Ansible (#46376) 2018-10-04 05:55:02 +10:00
Kevin Subileau
ac9d506a61 win_nssm: tests and several bug fixes (#44755)
* win_nssm: add failing tests for issue #44079

* win_nssm: use Run-Command instead of Invoke-Expression to prevent interpretation issue

Fix #44079

* win_nssm: add more failing tests

These tests highlight several issues with this module:
 * Service not started when state=started
 * Errors with app_parameters (see #25265)
 * Exception when passing several dependencies separated by comma as specified in doc

* win_nssm: fix service not started when state=started

Nssm status returns a multiline output that doesn't match any of the strict patterns in the switch statement.

* win_nssm: fix incorrect separator in doc for service dependencies

The dependencies parameter works with space as separator, but not with comma as shown in the documentation

* win_nssm: fix error with app_parameters parameter

Fix #25265

* win_nssm: add idempotence tests

* win_nssm: fix several idempotence issues and misbehaviors

Add missing space between arguments when app_parameters contains several keys.
Use Argv-ToString and Escape-Argument to improve arguments handling (parameters with quotes, backslashes or spaces).

* win_nssm: test parameters with spaces, quotes or backslashes

* win_nssm: restore comma as separator for service dependencies

Revert commit ddd4b4b

* win_nssm: restore support of string as dict form for app_parameters and remove support of literal YAML dict

* win_nssm: wrong variable in tests
2018-09-27 13:15:04 +10: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
John R Barker
f4f5d941e5
botmeta support: core (#45917)
* botmeta enforce `support: core`
2018-09-25 18:37:01 +01:00
Matt Martz
49eb53b44d
pylint plugin to catch due/past-due deprecated calls (#44143)
* Start of work on pylint plugin to catch due/past-due deprecated calls

* Improve deprecated pylint plugin

* Catch call to AnsibleModule.deprecate also

* Skip splatted kwargs, we can't infer that info

* Add error for invalid version in deprecation

* Skip version if it's a reference to a var

* Disable ansible-deprecated-no-version for displaying deprecated module info

* fix comments

* is None

* Force specifying a version, this can be disabled on a per case basis

* Disable ansible-deprecated-version by default

* Remove to look for 2.8 deprecated

* Revert "Remove to look for 2.8 deprecated"

This reverts commit 4e84034fd1.

* Add script and template used for creating issues for deprecated issues

* Fix underscore var
2018-09-25 10:31:41 -05: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
Matt Clay
4085d01617 Reduce noise in docs-build test failures. 2018-09-24 10:14:47 -07:00
René Moser
83ec418470
cs_loadbalancer_rule_member: fix error handling (#46012)
* make use of query_api
* fix sanity
2018-09-22 13:40:40 +02:00
Matt Clay
ac492476e5
Bug fixes and cleanup for ansible-test. (#45991)
* Remove unused imports.
* Clean up ConfigParser usage in ansible-test.
* Fix bare except statements in ansible-test.
* Miscellaneous cleanup from PyCharm inspections.
* Enable pylint no-self-use for ansible-test.
* Remove obsolete pylint ignores for Python 3.7.
* Fix shellcheck issuers under newer shellcheck.
* Use newer path for ansible-test.
* Fix issues in code-smell tests.
2018-09-21 11:38:22 -07:00
Matt Clay
2148999048 Improve error handling for docs-build test. 2018-09-21 08:34:07 -07:00
Dag Wieers
24dd87bd0a Fix incorrect use of subprocess.CalledProcessError (#45890) 2018-09-20 10:14:11 -07:00
max-allan-surevine
cb460dee74 Update keycloak_client.py (#43547)
* Update keycloak_client.py to document the 'realm' parameter, eliminate E322 ignore
2018-09-20 10:34:04 -05:00
Matt Clay
f3d1f9544b
Make ansible-test available in the bin directory. (#45876) 2018-09-19 17:58:55 -07:00
Eric Helms
74b94e119e Deprecate foreman and katello modules (#42043)
* Deprecate foreman and katello modules in 2.8, remove in 2.12
2018-09-19 11:41:54 -05:00
Dag Wieers
2edf20d1ed Docs: Avoid use of 'default: null' (#45795)
Various modules document the default 'null' value, but it causes None to
be shown in the documentation explicitly.
2018-09-19 09:02:27 -05:00
John R Barker
78201d1c32 Allow removed_in: 2.12 (#45732) 2018-09-17 10:54:00 -04:00
Matt Clay
e7426e3795
Minor cleanup of code-smell tests. (#45658)
* Minor cleanup of code-smell tests.
* Add exception handling for YAML load.
2018-09-14 11:12:06 -07:00
John R Barker
822236810e
BOTMETA Validator + Bulk tidyup, support:(core,community,network) (#44903)
plugins/ is COMMUNITY
Set sensible defaults for directories
support:network for the platforms that we Networking SUPPORTS,
everything else is COMMUNITY
Mark other support:network (ansible-connection, etc)
Infoblox is support:core
contrib/ by definition should be support:community
Remove duplicated labels
Make yamllint happy(ier)
Adds sanity test to ensure BOTMETA.yml is valid
2018-09-14 12:33:23 +01:00
Alicia Cozine
4264be2b18 Remove more docs build errors (#45364)
* orphans testing pages to avoid not-in-toctree errors

* orphans various pages pending reorg

* adds module_utils and special_vars to main TOC

* uses a glob for scenario_guide TOC

* normalize and Sentence-case headings on community pages, typos

* re-orgs community TOC, adds all pages to toctree

* removes scenario guides index page

* adds style guide to community index

* basic update to style guide

* fix typo that created a new error

* removes not-in-toctree from ignore errors list

* leave removing files for future cleanup task
2018-09-11 17:51:47 +01:00
Jordan Borean
ec6d82435f
win_scheduled_task: add deprecation warning for repetition format (#45468)
* win_scheduled_task: add deprecation warning for repetition format

* fixed up sanity issues
2018-09-11 14:22:57 +10:00
Brian Coca
64c594d226
correct and clarify deprecation (#45234)
* correct and clarify deprecation
2018-09-06 13:24:44 -04:00
Matt Clay
6fb333faff
Fixes for ansible-test sanity import test. (#45249)
* Fix import test on Python 3.7.
* Fix path processing in import sanity test.
2018-09-05 13:54:50 -07:00
Matt Martz
f89d873698
Stub out modules scheduled for 2.8 removal (#44985)
* Remove modules scheduled for 2.8

* Add changelog and porting guide

* Skip docs test on removed modules

* Don't link to removed modules
2018-08-31 16:27:32 -05:00
Matt Clay
abdd6a6475 Fix pslint issues. 2018-08-30 19:38:17 -07:00
Dag Wieers
15c9bb5aa0
Disable PSUseOutputTypeCorrectly
Because of a bug that produces false positives.
2018-08-31 02:52:57 +02:00
newtonne
30fd326953 Various updates to macports module (#44605)
- Add support for installing specific variants of a port.
- Add support for using yaml lists with 'name' parameter, rather than comma-separated lists.
- Add to and clarify documentation and examples.
- Use Macports nomenclature:
  - s/package/port/g
  - Rename update_cache to sync_ports but keep update_cache as an alias. Remove undocumented update-cache alias.
  - Remove undocumented 'pkg' alias for 'name'. Replace with 'port' alias and document it.
- Print stdout and stderr output if `port sync` fails.
- Print stderr output, rather than stdout, if `port install/uninstall/activate/deactivate` fail.
2018-08-30 05:03:29 +02:00
Chris Archibald
7cded31ec9 Depreciate elementsw modules (#44792)
* rename deprecated files
2018-08-29 17:51:52 +01:00
Dag Wieers
5e814d8d17 Fix support for JSON output when charset is set (#44762)
* Fix support for JSON output when charset is set

This fixes #41797

* Add specific exception to catch

* Add Changelog fragment
2018-08-29 08:10:46 +10:00
René Moser
dd953dbe96
cs_template: implement update and revamp (#37015) 2018-08-28 19:55:21 +02:00
Michael Price
f89374bf6d Update the ignore and doc_fragments for E-Series
Make the generic updates to remove unneeded ignores and improve the
documentation for the NetApp E-Series modules.
2018-08-27 13:52:58 -07:00
Toshio Kuratomi
68c60ad307 Change validate-modules for removed modules
Removed modules now don't have documentation.  Need to account for that
when checking them in validte-modules
2018-08-24 15:37:13 -07:00
Toshio Kuratomi
3ccdb35f59 Do not test for docs in removed modules 2018-08-24 15:37:13 -07:00
Aren
9db3e597f3 state: present added in docs (#37197)
* state: present added in docs

* atomic_container.py docs now match argspec, enforce test
2018-08-24 12:22:18 -05:00
Michael Price
ad91793428 Resolve issues in NetApp E-Series Host module (#39748)
* Resolve issues in NetApp E-Series Host module

The E-Series host module had some bugs relating to the update/creation
of host definitions when iSCSI initiators when included in the
configuration. This patch resolves this and other minor issues with
correctly detecting updates.

There were also several minor issues found that were causing issues with
truly idepotent updates/changes to the host definition.

This patch also provides some unit tests and integration tests to help
catch future issues in these areas.

fixes #28272

* Improve NetApp E-Series Host module testing

The NetApp E-Series Host module integration test lacked feature test
verification to verify the changes made to the storage array.

The NetApp E-Series rest api was used to verify host create, update, and
remove changes made to the NetApp E-Series storage arrays.
2018-08-24 15:44:59 +01:00
Felix Fontein
0e6234ab04 Adding module which allows to complete certificate chains (#44169)
* Adding certificate_complete_chain module.

* Avoid code smell errors.

* Removing input_chain_src.

* Make sure line ending is there.
2018-08-23 23:18:36 +02:00
Matt Clay
31a5b874a1 Use runtime instead of datetime for test output. 2018-08-23 12:05:10 -07:00
Ondra Machacek
24c26aded8 oVirt: Add depracation warning to all modules (#44440) 2018-08-23 09:42:05 -04:00
/v\atthew L Daniel
d7e66f16a6 Correct the default doc for attached in ec2_eni (#44523)
* Correct the default doc for attached in ec2_eni

Also corrected a typo in the summary

* Address ansible-test sanity error about E324

* Fix and remove the E325 suppression for ec2_eni
2018-08-23 12:44:49 +10:00
Chris Archibald
9dceca8a88 Deprecated Old NetApp Cdot Modules (#43781)
* MVP2 Post ElementSW OSRB sync

* Revert "MVP2 Post ElementSW OSRB sync"

This reverts commit c13db2ad962cd56bffce052c2891c558a2240c72.

Undoing bad push

* move deprecated files

* add documentation

* add new line

* Fix version issue

* fix issue with ignore file, hopefully

* Add ontap modules to porting guide

* fix refs

* add _module to ref
2018-08-14 09:39:52 -07:00
René Moser
1fb0e11b56
vultr: rename prefix vr_to vultr_ (#43994)
* vultr: rename modules

* replace string vr_ with vultr_

* add deprecation warning

* fix sanity tests

* add changelog
2018-08-13 10:21:50 +02:00
Chris Archibald
479408330e Adding Common files for NetApp ElementSW release (#43727)
* MVP2 Post ElementSW OSRB sync

* Revert "MVP2 Post ElementSW OSRB sync"

This reverts commit c13db2ad962cd56bffce052c2891c558a2240c72.
2018-08-10 09:33:08 -07:00
Matt Martz
54e4c53f00
Ensure removed_in is StrictVersion before comparing (#43835)
* Ensure removed_in is StrictVersion before comparing

* Catch ValueError with StrictVersion on incompatible versions
2018-08-08 14:29:14 -05:00
Felix Fontein
e7e63ec1e8 Improving syntax highlighting in HTML docs (#42472)
* Adding improved YAML lexer for HTML docs.

* Fixing (some of) the warnings.

* Fixing more warnings.

* Removing ansible- prefix from lexer names.

* Rename extensions -> _extensions.

* Removing superfluous module search path extension.
2018-07-31 15:28:16 -05:00
Matt Martz
01c0446cb5
Add AnsibleModule signature schema, and fix associated issues (#43512) 2018-07-31 15:04:22 -05:00
Joren Vrancken
9e310558ee Enable PEP8 testing of E305 2018-07-31 12:06:56 -07:00
Egor Zaitsev
249a6aae22 New module: routeros — manage MikroTik RouterOS (#41155)
* Implement initial RouterOS support

* Correct matchers for license prompts

* Documentation updates & mild refactor

* Remove one last Cisco function

* Sanity test fixes

* Move imports to the beginning

* Remove authorize property

* Handle ANSI codes

* Revert to_lines function

* CR fixes

* test(routeros): add unit tests

* Added another test (with ANSI colors and banner in fixture).

* Ignore CRLF line endings in system_package_print file

* fix: review by ganeshrn
2018-07-30 10:28:03 +05:30
Florian Braun
74af52533f Variable Timout for Katello Module + Documentation (#41834)
* Changed Foreman timeout to be setable via a parameter
Added a Parameter to set the timout to wait for the started Foreman actions
by the user instead of using the hard coded 1000 Seconds

* katello module screamed for more docu :)

* fix docu + some ci findings
made docu better and moved chices in relations to other options to the description

* added a quote to description and removed wrong combination of param product

* Removed choices from params
also removed katello from a ignore file
2018-07-27 12:31:12 -07:00
Toshio Kuratomi
52449cc01a AnsiballZ improvements
Now that we don't need to worry about python-2.4 and 2.5, we can make
some improvements to the way AnsiballZ handles modules.

* Change AnsiballZ wrapper to use import to invoke the module
  We need the module to think of itself as a script because it could be
  coded as:

      main()

  or as:

      if __name__ == '__main__':
          main()

  Or even as:

      if __name__ == '__main__':
          random_function_name()

  A script will invoke all of those.  Prior to this change, we invoked
  a second Python interpreter on the module so that it really was
  a script.  However, this means that we have to run python twice (once
  for the AnsiballZ wrapper and once for the module).  This change makes
  the module think that it is a script (because __name__ in the module ==
  '__main__') but it's actually being invoked by us importing the module
  code.

  There's three ways we've come up to do this.
  * The most elegant is to use zipimporter and tell the import mechanism
    that the module being loaded is __main__:
    * 5959f11c9d/lib/ansible/executor/module_common.py (L175)
    * zipimporter is nice because we do not have to extract the module from
      the zip file and save it to the disk when we do that.  The import
      machinery does it all for us.
    * The drawback is that modules do not have a __file__ which points
      to a real file when they do this.  Modules could be using __file__
      to for a variety of reasons, most of those probably have
      replacements (the most common one is to find a writable directory
      for temporary files.  AnsibleModule.tmpdir should be used instead)
      We can monkeypatch __file__ in fom AnsibleModule initialization
      but that's kind of gross.  There's no way I can see to do this
      from the wrapper.

  * Next, there's imp.load_module():
    * https://github.com/abadger/ansible/blob/340edf7489/lib/ansible/executor/module_common.py#L151
    * imp has the nice property of allowing us to set __name__ to
      __main__ without changing the name of the file itself
    * We also don't have to do anything special to set __file__ for
      backwards compatibility (although the reason for that is the
      drawback):
    * Its drawback is that it requires the file to exist on disk so we
      have to explicitly extract it from the zipfile and save it to
      a temporary file

  * The last choice is to use exec to execute the module:
    * https://github.com/abadger/ansible/blob/f47a4ccc76/lib/ansible/executor/module_common.py#L175
    * The code we would have to maintain for this looks pretty clean.
      In the wrapper we create a ModuleType, set __file__ on it, read
      the module's contents in from the zip file and then exec it.
    * Drawbacks: We still have to explicitly extract the file's contents
      from the zip archive instead of letting python's import mechanism
      handle it.
    * Exec also has hidden performance issues and breaks certain
      assumptions that modules could be making about their own code:
      http://lucumr.pocoo.org/2011/2/1/exec-in-python/

  Our plan is to use imp.load_module() for now, deprecate the use of
  __file__ in modules, and switch to zipimport once the deprecation
  period for __file__ is over (without monkeypatching a fake __file__ in
  via AnsibleModule).

* Rename the name of the AnsiBallZ wrapped module
  This makes it obvious that the wrapped module isn't the module file that
  we distribute.  It's part of trying to mitigate the fact that the module
  is now named __main)).py in tracebacks.

* Shield all wrapper symbols inside of a function
  With the new import code, all symbols in the wrapper become visible in
  the module.  To mitigate the chance of collisions, move most symbols
  into a toplevel function.  The only symbols left in the global namespace
  are now _ANSIBALLZ_WRAPPER and _ansiballz_main.

revised porting guide entry

Integrate code coverage collection into AnsiballZ.

ci_coverage
ci_complete
2018-07-26 20:07:25 -07:00
Julien Champseix
19dc267e4c Allow specifying the output encoding in the template module (#42171)
Allow specifying the source and destination files' encodings in the template module

* Added output_encoding to the template module, default to utf-8
* Added documentation for the new variables
* Leveraged the encoding argument on to_text() and to_bytes() to keep the implementation as simple as possible
* Added integration tests with files in utf-8 and windows-1252 encodings, testing all combinations
* fix bad smell test by excluding windows-1252 files from the utf8 checks
* fix bad smell test by excluding valid files from the smart quote test
2018-07-25 13:10:40 -07:00
saichint
fa5f396a4b nxos_file_copy enhancement (#42424)
* add file_pull option

* typo correction

* fix shippable error

* review comments

* fix for review comments by mwiebe

* possible shippable fix

* remove file_copy from ignore

* more review comments addressed

* review comments

* add localhost for remote scp server in tests

* timeout fix
2018-07-25 17:46:55 +05:30
tomelrod
5eb47066e3 Documentation change for resizefs (#43224)
* Documentation change for resizefs

Changed documentation to match the default value of resizefs set in the code.
Added a note on the resizefs use on the example utilizing it.

* Remove test now it validates fine
2018-07-25 00:22:24 +02:00
Matt Clay
4e489d1be8
Update Shippable integration test groups. (#43118)
* Update Shippable integration test groups.
* Update integration test group aliases.
* Rebalance AWS and Azure tests with extra group.
* Rebalance Windows tests with another group.
2018-07-23 20:46:22 -07:00
Jordan Borean
93c05074ee
win_chocolatey: refactor module to fix bugs and add new features (#43013)
* win_chocolatey: refactor module to fix bugs and add new features

* Fix some typos and only emit install warning not in check mode

* Fixes when testing out installing chocolatey from a server

* Added changelog fragment
2018-07-24 07:52:13 +10:00
Abhijeet Kasurde
b02e0c07d8
dnsimple: refactor dnsimple module (#42548)
* Update dnsimple-python minimum version to 1.0.0 as it supports API v2 and API v1 is deprecated.
* Update examples.
* Update documentation.

Fixes: #42495

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-07-21 08:58:39 +05:30
Dag Wieers
95a1170908 Windows: Add "special" parameter types to docs (#42853)
* Windows: Add special parameter types

Adding explicit parameter types now exposes this information in the
module documentation, and proves really helpful.

We only do this for non-string types as strings, mostly because strings
are implicit.

PS We also make copyright statements consistent and use #Requires for
explicit library imports

* Type "string" must be type "str"

* A few more Copyright corrections

* More fixes

* Don't add file encoding to Powershell files

* Don't add missing interfacetypes parameter

Otherwise CI demands an incorrect version_added

* Small fix
2018-07-17 14:29:05 -07:00
Tim Rupp
290df027e3
Adds the ipaddress compat library backport from Python 3.x (#42265)
This library is a backport (to 2.x versions of Python) of the code
that is found in the mainline versions of Python 3.x. It is being
included so that networking vendors, and others, can make use of it
without needing to add a python module dependency to their own modules.

A separate dependency would add to user burden of satisfying those
dependencies before using some Ansible modules.

In a previous core meeting, this was approved. Naming of the directory
it is found in was up for debate, but "compat" was the first directory
to have some sort of concensus.
2018-07-17 11:37:23 -07:00
Dag Wieers
e899824c49
ACI: Add parameter types to module docs (#42893)
* ACI: Add parameter types to module docs

* Update validate-modules ignore list
2018-07-17 18:03:55 +02:00
Wojciech Sciesinski
cf4e7fd70a Make the code more PowerShell compliant (#39464)
* Make the code more PowerShell compliant

* Correction of the mistaken comment

* Revert style changes to If/Else/Elseif

* Remove an ignored PSScriptAnalyzer rule due to the code correction

* Decreasing of an entropy ;-) and replacing the next to aliases

* minor whitespace changes
2018-07-16 11:34:01 +10:00
Sloane Hertel
2c3e6f8bd3 [elb_target_group] fix docs and add default for wait_timeout - fixes #42324 (#42477)
Add default for wait_timeout and version_added flag
2018-07-13 15:09:33 -04:00
Yanis Guenane
593f484d77 Fix E324 for vultr modules. (#42464) 2018-07-10 07:51:05 +02:00
John R Barker
d962611528 Allow documentation of module options type (#42285)
* Allow documentation of module options

Pass through the `type` of a modules option so it's displayed on the
html module docs

* docs
2018-07-05 09:57:58 -04:00
fxfitz
f92b95b8cb Remove ipa_ modules from sanity ignore; fix the docs 2018-07-03 18:16:09 -07:00
Dag Wieers
57c0471b54
Fix ACI validate-modules issues (#42222) 2018-07-03 04:04:35 +02:00
tstoner
db7300904d Enforcing NXAPI default HTTP behavior (#41817)
* nxos_nxapi http default behavior

* Use nxos_nxapi module in prepare_nxos_tests

* Refactor nxos_nxapi configure test to use yaml block

* Extend nxos_nxapi https & http test cases

* Removed NXOS internal release naming

* Resolved ansibot sanity errors

* Fix typo in prepare_nxos_tests

* Address PR comments

* Shippable indicates this is no longer needed

* Add port change logic and testing
2018-07-02 14:58:37 -04:00
John R Barker
6024a766e9
Allow removed_in 2.11 (#42119) 2018-06-29 09:42:54 -07:00
Andrea Tartaglia
a342538aba Add shell out checks (#41545)
* Added error codes for shell_out checks

* Added ignore lines for allowed Modules

* Added shell out checks

* Fixed pep8

* Updated regex to only match subprocess.Popen

* Added failing modules to ignore.txt

* Wrong postgresql module in ignore.txt

* Removed bigip from ignore.txt
2018-06-21 11:58:39 -04:00
Abhijeet Kasurde
27b85e732d Argument spec must be dict/hash (#40858)
validate-modules should fail when argument is not dict/hash.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-20 12:05:49 -04:00
Ben Berry
32c191ee9c expand user before calling abspath (#40196)
* expand user before calling abspath

* omit expanduser code smell check for volumes
2018-06-13 21:18:02 -04:00
Matt Clay
70c475da6c Implement new changelog generator. 2018-06-05 19:08:15 -07:00
Matt Martz
d4930e6692
Add requests.Session like class (#37622)
* Adds requests.Session like class

* py2 syntax fix

* Add a few examples to the Request docstrings

* Add helper methods and docs

* Fix test failures

* Switch tests to test Request instead of open_url, add simple open_url test to validate funcitonality

* Fix filename in replace-urlopen code smell test
2018-06-01 11:44:20 -05:00
Sloane Hertel
7d2c71462d gluster_volume: add 'volume' alias to 'name' param (#40845)
* gluster_volume: add 'volume' alias to 'name' param

* remove gluster_volume from validate-modules/ignore.txt
2018-05-30 02:06:46 +02:00
Pilou
de385560a8 jenkins_jobs: fix typos (#40844)
* jenkins_job: fix typos

* jenkins_job: add type for 'enabled' parameter
2018-05-30 01:44:02 +02:00
Matt Martz
36c8441c6d New module vmware_deploy_ovf (#30309)
* First pass at vmware_deploy_ovf functionality
* Add OVA file support, re-structure code
* Move some useful functions to module_utils.vmware, and perform a little DRY too
* Better handling of errors during spec validation and import
* Properly calculate the lease progress percentage for all vmdk files
* Make warnings and errors a little better
* Add an allow_duplicates argument, that defaults to true, to allow users to have name based idempotency
* Add fail_on_spec_warnings to cause the module to treat warnings as errors
* Support non-vmdk uploads
* Add ova alias for ovf
* Rename vmdk_post_url to device_upload_url so it does not sound to specific to VMDK files
* Safer handling of * hostname in urls
* Add default Content-Type, remove unused headers var
* Add deploymentOptions and propertyMapping functionalities
* Add basic check_mode support
* Add vmware_deploy_ovf to list of use-argspec-type-path ignores
* Update version_added and fix path for use-argspec-type-path
* Add configurable folder
* Doc changes
2018-05-29 21:38:43 +05:30
Matt Clay
45c6fa9784 Update gluster_volume path in ignore.txt. 2018-05-29 08:35:13 -07:00
Matt Martz
b07f779296 Update dnf module argument_spec and docs to match (#39819)
* Update dnf module argument_spec and docs to match. Fixes #39800

* Always evaluate autoremove as boolean
2018-05-28 06:26:04 -04:00
Zim Kalinowski
dde48560fb fixing container instance sanity & integration tests (#40774) 2018-05-28 12:59:26 +08:00
Strahinja Kustudic
de57fa71c1 Improve timezone module for none systemd Linux distributions (#38032)
* The module now correctly sets the timezone in both the config file and
in /etc/localtime; while hwclock is set in both the config and
/etc/adjtime.
* Module checks if the timezone is actually set by checking
/etc/localtime. Before it only checked if it was set in the config file.
* Fixed module not setting the timezone on RedHat systems if
/etc/localtime was a symbolic link.
* Fixed module failures in case of missing config files or incorrect data
in them.
* Added a lot of integrations tests to cover most of these situations.
2018-05-25 12:01:03 -05:00
René Moser
5dd3aa26ea
cs_instance: implement host migration support (#40309)
* cs_instance: implement host migration support

* fix build

* fail fast on update if user is not admin

* improve tests a bit

* expunge it

* fix typo

* disable temporarly verify for host on starting instance.
2018-05-25 11:20:04 +02:00
Jiri Tyr
e6e5e45d7e Fixing choices for transport option in gluster_volume module (#38815) 2018-05-25 03:30:30 -04:00
Ryan Brown
858a1b09bb EC2_group module refactor (formerly pr/37255) (#38678)
* Refactor ec2_group

Replace nested for loops with list comprehensions

Purge rules before adding new ones in case sg has maximum permitted rules

* Add check mode tests for ec2_group

* add tests

* Remove dead code

* Fix integration test assertions for old boto versions

* Add waiter for security group that is autocreated

* Add support for in-account group rules

* Add common util to get AWS account ID

Fixes #31383

* Fix protocol number and add separate tests for egress rule handling

* Return egress rule treatment to be backwards compatible

* Remove functions that were obsoleted by `Rule` namedtuple

* IP tests

* Move description updates to a function

* Fix string formatting missing index

* Add tests for auto-creation of the same group in quick succession

* Resolve use of brand-new group in a rule without a description

* Clean up duplicated get-security-group function

* Add reverse cleanup in case of dependency issues

* Add crossaccount ELB group support

* Deal with non-STS calls to account API

* Add filtering of owner IDs that match the current account
2018-05-24 11:53:21 -04:00
Matt Clay
15b6837daf Add yamllint for plugin docs and fix issues. 2018-05-23 09:19:30 -07:00
pierremahot
3903ca5c8e Fix ios_vlan to correctly identify unmodified config when having long interface names (#40145)
Change the command to get the interface in a vlan "show vlan" => "show vlan brief"
Change the parsing of the return command of the switch.
The return of the ios command is fixed so i cut with fix number of carracter.
Adding looking for the next line to add the forgeted interfaces.
2018-05-23 10:15:54 -04:00
Zim Kalinowski
8e38668285 fixing disabled azure sanity tests (#40519)
* fixing azure sanity tests

* fixing sanity

* fixing some tags issues

* removed unnecessary things from managed disk

* fixed location problem

* more sanity fixes

* sanity test fixes

* final sanity fixes?

* final fixes again

* undo changes related to container instance

* removed container instance

* readd again

* fixed stupid mistake

* removed _azure from changes

* one more mistake
2018-05-23 00:49:04 -04:00
Matt Clay
8deced3e04
Fix shebangs and file modes and update tests. (#40563)
* Add execute bit sanity test and apply fixes.
* Add shebang test for `lib` dirs and apply fixes.
* Shebang and execute bit cleanup.
2018-05-22 14:25:36 -07:00
Matt Clay
8d39515914 Remove tab check from validate-modules.
It is redundant with the pycodestyle W191 "indentation contains tabs" check.
2018-05-21 14:45:19 -07:00
Strahinja Kustudic
32d6a354d7 postgresql_user: set encrypted as default and fix empty password reporting changed (#36931)
* Set encrypted as default and fix empty password reporting changed

* Starting with Postgres 10 `UNENCRYPTED` passwords are removed and
because of that this module fails with the default `encrypted=no`.
Also encrypted passwords are suported since version 7.2
(https://www.postgresql.org/docs/7.2/static/sql-createuser.html) which
went EOL in 2007 and since 7.3 it is the default. Because of this it
makes a lot more sense to make `encrypted=yes` the default. This won't
break backward compatibility, the module would just update the user's
password in the DB in the hashed format and everything else will work
like before. It's also a security bad practice to store passwords in
plain text. fixes #25823
* There was also a bug with `encrypted=yes` and an empty password always
reported as changed.
* Improved documentation for `encrypted`/`password` parameters, and
removed some obsolete notes about passlib.

* Fix clearing user's password to work with all versions of Postgres

* Add tests for clearing the user password

* Fix documentation atfer rebase

* Add changelog fragment
2018-05-21 14:49:44 -05:00
John R Barker
fe4368ce15
removed_in: 2.6 is valid (#40399) 2018-05-18 15:32:31 +01:00
Toshio Kuratomi
46d35d8919 unarchive now passes the E322 test 2018-05-17 15:24:56 -07:00
René Moser
de8b6b55f7
cs_vpc: implement state=started (#40319) 2018-05-17 22:42:53 +02:00
Anil Kumar Muraleedharan
1cb4619c9a Modifying cnos-facts, cnos_command and cnos-config in line with the design followed in Ansible. Adding unit test cases for these modules. Added plugins to support them. (#39955)
* Modifying cnos-facts, cnos_command and cnos-config in line with the design followed in Ansible. Adding unit test cases for these modules. Added plugins to support them.

* Removing doc fragment conflicts with other modules

* Replacing show with display
2018-05-17 10:06:24 -04:00
Dag Wieers
3cdd5da247
xml: Fix validate-modules issue (#40121) 2018-05-15 02:29:48 +02:00
Zim Kalinowski
b20a88c39d fix problem with documentation and param definition difference (#40067)
* fix problem with documentation and param definition difference

* removed some E324 from ignore.txt

* fixed mistake

* remove one more E324

* removed function app

* fixing append tags

* leaving append tags for later
2018-05-15 07:01:08 +10:00
Tim Rupp
06f76d6407
Removes ignores for f5 (#40038)
Removes ignores for f5 from unit tests and fixes any issues that
are being suppressed by the ignores
2018-05-11 17:12:17 -07:00
Tim Rupp
d312c2aed7
Various bigiq fixes (#40024)
Udpdating coding conventions
2018-05-11 12:59:29 -07:00
Tim Rupp
742fd3a91a
Adds misc fixes for gtm facts module (#39966)
Codifies some parameters and fixes f5 coding conventions
2018-05-10 09:57:27 -07:00
Trishna Guha
f1103a7a02
remove purge from nxos_logging doc, argspec (#39947)
* remove purge from nxos_logging doc, argspec

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* shippable

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2018-05-10 15:28:37 +05:30
Dag Wieers
d7f3d3b867
Fix module validation checks and remove old params (#39926)
This PR includes:
- Fixes to the majority of module validation issues
  (deliberate inconsistencies between docs and arg_spec)
- Removal of deprecated parameters 'method' and 'protocols'
- A few typos in the documentation

There are still some left-over validation errors, some are deliberate
(like doc strings as default to indicate ranges, etc.)
2018-05-10 08:47:08 +02:00
Matt Clay
a7d7df1450 Make docs-build sanity test disabled by default. 2018-05-09 17:55:00 -07:00
Tim Rupp
ad5fdf5eb7
Fixes for bigip_gtm_wide_ip (#39931)
Added the irules parameter. Misc corrections of invalid parameter
names and internal behaviors.
2018-05-09 17:28:07 -07:00
Matt Martz
1663b64e18
Allow subspec defaults to be processed when the parent argument is not supplied (#38967)
* Allow subspec defaults to be processed when the parent argument is not supplied

* Allow this to be configurable via apply_defaults on the parent

* Document attributes of arguments in argument_spec

* Switch manageiq_connection to use apply_defaults

* add choices to api_version in argument_spec
2018-05-07 11:23:13 -05:00
Rob
b5cffe8ced [aws] Create classes for Application Load Balancer (#33769)
* Create classes for Application Load Balancer
* Add unsupported CI alias
* Add AWSRetry
* Add integration tests using the ALB
2018-05-04 16:22:00 -04:00
Pilou
a5d320f8e7 vdirect modules: fix 'import' sanity test (#39706)
* vdirect modules: fix 'import' sanity test

* Remove passing file from import skip list.

* vdirect modules: fix validate-modules warnings

- Arguments with a default should not be marked as required
- add choices in doc

* vdirect_runnable: use formatting function
2018-05-03 18:13:06 -07:00
Alicia Cozine
c8a9b411bc
Last docs link fixes (#39391)
* should not need <>, but fails without

* adds anchor to keywords page, uses it on plugins pages

* fixes envvar link errors

* harmonize file name and ref name as python_3

* removes undefined-lable from ignore list
2018-04-27 13:21:39 -05:00
Tim Rupp
fb264281de
Adds various features and fixes (#39271)
* a refactor of pool member and node modules to be inline with current f5 conventions
* Added priority_group_activation to pools
* various other small convention fixes and bug fixes
2018-04-25 07:16:11 -07:00
saichint
1afec5a48e fix nxos_snmp_community issues (#39258) 2018-04-25 13:16:41 +05:30
Tim Rupp
256b5535ec
Various fixes to F5 modules (#39255)
* Adds gnat provisioning to bigip_provision
* Adds special handling for AFM in bigip_provision
* Add device rebooting for provisioning as necessary
* Refactored route domain module to be inline with current f5 conventions
* Minor refactors across modules
2018-04-24 19:49:52 -07:00
John R Barker
7c4b91844d
More validate module fixes (#39097)
* Fix type bool DOCUMENTATION issues
2018-04-24 18:05:50 +01:00
Tim Rupp
39e4754fc9
Fixes for convention incompatibilities (#39209)
Minor fixes for the f5 modules to use current conventions
2018-04-23 21:42:06 -07:00
Tim Rupp
e254121729
Adds minor fixes and features to f5 modules (#39202)
* Add Mac_address parameter to bigip_traffic_group
* Fix docs
* Fix f5 conventions
2018-04-23 18:57:43 -07:00
Pierre-Louis Bonicoli
afef20827b openshift_raw & openshift_scale: fix broken import 2018-04-23 17:57:17 -07:00
Pierre-Louis Bonicoli
5d72f29b1a Remove passing file from import skip list. 2018-04-23 17:55:45 -07:00
Tim Rupp
19d229a8e0
Fixes F5 conventions and adds features (#39189)
This patch fixes a number of convention changes in F5 modules.
Additionally, it adds some features to bigip vlan and other modules
2018-04-23 15:46:09 -07:00
Pierre-Louis Bonicoli
2f535a339c azure_rm_storageaccount: fix broken import 2018-04-23 09:04:03 -07:00
Matt Clay
9e8889bb70
Fix more docs errors. (#39051)
* Fix remaining unknown-document docs errors.
* Fix last toc-tree-missing-document docs error.
2018-04-20 00:24:47 -07:00
Matt Clay
7e96421132
Handle warnings in docs-build sanity test. (#39043) 2018-04-19 23:09:48 -07:00
Thierry BOUVET
4117b2dd29 Fix documentation fragments for docker (#38378) 2018-04-17 08:51:56 -07:00
Nathaniel Case
3b3c72f3e5
Fix use of bytes in cliconf plugins for Python 3 (#37715)
* Remove raw byte-strings from cliconf plugins of supported platforms + edgeos

Remove uses of to_bytes, too

* Update CliConfBase docstring to reflect current position on byte strings
2018-04-17 10:15:21 -04:00
saichint
1d975bdc93 fix nxos_ntp_options (#38695) 2018-04-13 06:17:32 -04:00
Matt Clay
8a223009ca
Improve handling of integration test aliases. (#38698)
* Include change classification data in metadata.
* Add support for disabled tests.
* Add support for unstable tests.
* Add support for unsupported tests.
* Overhaul integration aliases sanity test.
* Update Shippable scripts to handle unstable tests.
* Mark unstable Azure tests.
* Mark unstable Windows tests.
* Mark disabled tests.
2018-04-12 16:15:28 -07:00
Matt Clay
26fa3adeab Add docs-build sanity test. 2018-04-12 15:56:49 -07:00
saichint
ed42331105 fix nxos_igmp_snooping issues (#38566)
* fix nxos_igmp_snooping issue

* shippable error fix
2018-04-11 10:14:27 -04:00
John R Barker
38491fe93d
Explicitly exclude W504 (#38539)
pycodestyle 2.4 has changed the default for W504
2018-04-10 20:07:57 +01:00
Matt Martz
6332beef65
Add unit tests for ansible.module_utils.urls (#38059)
* Start of tests for ansible.module_utils.urls

* Start adding file for generic functions throughout urls

* Add tests for maybe_add_ssl_handler

* Remove commented out line

* Improve coverage of maybe_add_ssl_handler, test basic_auth_header

* Start tests for open_url

* pep8 and ignore urlopen in test_url_open.py tests

* Extend auth tests, add test for validate_certs=False

* Finish tests for open_url

* Add tests for fetch_url

* Add fetch_url tests to replace-urlopen ignore

* dummy instead of _

* Add BadStatusLine test

* Reorganize/rename tests

* Add tests for RedirectHandlerFactory

* Add POST test to confirm behavior is to convert to GET

* Update tests to handle recent changes to RedirectHandlerFactory

* Special test, just to confirm that aliasing http_error_308 to http_error_307 does not cause issues with urllib2 type redirects
2018-04-09 10:17:43 -05:00
jhawkesworth
ad94d03ba1 Tolerate win line endings on windows module_util load (#37291)
* tolerate windows line endings when loading windows module utils.  Helpful for old custom windows modules.

* add test modules to demonstrate win line ending module load behaviour.

* attempt to fix sanity check failures

* pep8 fix

* explict skip of test modules from shebang check (core modules must still have expected unix style line endings)

* switch to rstrip() following core team meeting feedback
2018-04-06 07:13:31 +10:00
Jordan Borean
f37a44430f win_service: fix when dealing with paths with special chars and change WMI to CIM cmdlets (#37897)
* win_service: fix when dealing with paths with special chars and change WMI to CIM cmdlets

* compare username in lowercase for test
2018-04-03 18:28:10 -07:00
René Moser
b06dfbec54
cs_user: fix E325 (#38158) 2018-03-31 11:44:04 +02:00
Matt Martz
ffbbb5a25b
Use arg_spec type for comparisons on default and choices (#37741)
* Use arg_spec type for comparisons on default and choices

* Further improve type casting

* Make sure to capture output in more places

* Individually report invalid choices

* Update ignore.txt after resolving merge conflicts
2018-03-26 12:15:32 -05:00
saichint
0df5cfd41f fix nxos_static_route issues (#37614)
* fix nxos_static_route issues

* remove nxos_static_route from ignore
2018-03-26 11:13:32 -04:00
Matt Clay
0dade18f43 Fix yamllinter handling of tuple assignment. 2018-03-22 23:14:21 -07:00
Dag Wieers
2c2f335893
win_psexec: Fix pslint issues (#37718) 2018-03-22 03:21:07 +01:00
Dag Wieers
de5fb66026
win_product_facts: Fix pslint issues (#37722) 2018-03-22 03:18:48 +01:00
Dag Wieers
fdc0e5c5fb
win_defrag: Fix pslint issues (#37719) 2018-03-22 00:06:42 +01:00
Dag Wieers
f78b415db0
win_wakeonlan: Fix pslint issues (#37717) 2018-03-21 23:45:17 +01:00
Matt Clay
307d8b5330 Disable PowerShell null comparison test.
Too many false positives due to unknown types.
2018-03-21 15:41:49 -07:00
Matt Clay
05220d693d
Complete updates of remaining code-smell tests. (#37743)
* Add text/binary file support to code smell tests.
* Enhance line-endings code smell test.
* Enhance no-smart-quotes code-smell test.
* Enhance shebang code-smell test.
2018-03-21 12:02:06 -07:00
Matt Clay
8daa80e5bb Move var precedence check to integration tests. 2018-03-21 09:43:32 -07:00
Matt Clay
775539a8b8 Fix api_profile choices in Azure docs fragment. 2018-03-20 11:07:34 -07:00
Dag Wieers
51662acc6c
Clean up Grafana docs a bit (#37516)
* Clean up Grafana docs a bit

But more is needed, default values, missing choices, proper
descriptions, actual sentences :-)

* Remove validate-modules entries
2018-03-17 02:53:26 +01:00
Dag Wieers
cdd21e2170
Clean up module documentation (#36909)
* Clean up module documentation

This PR includes:
- Removal of `default: None` (and variations)
- Removal of `required: false`
- Fixing booleans and `type: bool` where required

* Fix remaining (new) validation issues
2018-03-15 22:15:24 +01:00
Matt Martz
8980d275a0
Support recursive suboptions schema (#37206)
* Support recursive suboptions schema

* Remove todo line, add voluptuous version constraint
2018-03-09 17:09:58 -06:00
Pilou
bc6b96d42e webfaction modules: fix broken import (#35024)
* webfaction_app: fix broken import
* doc: use formatting functions
* webaction_db: fix broken import
* webfaction_domain: fix broken import
* webfaction_mailbox: fix broken import
* webaction_site: fix broken import
* webfaction modules: fix doc
2018-03-07 06:22:06 -08:00
René Moser
e1297af18a cs_router: fix missing doc (#37107)
* cs_router: fix missing doc

* update ignore.txt
2018-03-07 13:34:39 +00:00
René Moser
67d8c8f5c6 cs_ip_address.py: fix missing doc (#37109)
* cs_ip_address.py: fix missing doc

* update ignore.txt
2018-03-07 13:15:39 +00:00
René Moser
2559e832df
cloudstack: fix common E324 in docs (#37082)
Notes about precedence of common args.
Partly fixes E324.
2018-03-07 11:09:08 +01:00
René Moser
4705edd1a7
letsencrypt: add new param force (#37077)
* letsencrypt: add new param force to ignore remaining days

* letsencrypt: fix E325
2018-03-06 20:51:24 +01:00
Mikhail Naletov
7d0e1f92f4 [terraform] Support initializing modules and providers at runtime (#36996)
* Fixes #36994

Added function for force initializing modules and providers

Added type for force_init parameter
2018-03-05 11:01:53 -05:00
Matt Martz
ca092b5c26
Skip top level args that are the same as args in provider in doc<->arg_spec comparisons (#36911) 2018-03-01 10:47:20 -06:00
Gaurav Rastogi
60e39b9718 Updated the documentation of modules to match argspec including the type setting for bool parameters (#36821) 2018-02-28 14:38:03 +00:00
Matt Clay
dc71c2197f
More code-smell sanity test updates. (#36830)
* Add test for missing Azure requirements.
* Improve readability.
* Enhance no-unicode-literals code-smell test.
2018-02-28 00:50:00 -08:00
Matt Clay
ac1698099d
Overhaul additional sanity tests. (#36803)
* Remove unnecessary sys.exit calls.
* Add files filtering for code-smell tests.
* Enhance test-constraints code-smell test.
* Simplify compile sanity test.
* Pass paths to importer on stdin.
* Pass paths to yamllinter on stdin.
* Add work-around for unicode path filtering.
* Enhance configure-remoting-ps1 code-smell test.
* Enhance integration-aliases code-smell test.
* Enhance azure-requirements code-smell test.
* Enhance no-illegal-filenames code-smell test.
2018-02-27 15:05:39 -08:00
Matt Clay
60a24bbdaa Pass code-smell paths on stdin. 2018-02-27 00:36:16 -08:00
Mário Santos
8b52006d5c Fix sanity checks in OpenStack docs fragment (#36722)
* Fix sanity checks in OpenStack docs fragment

Signed-off-by: Mário Santos <mario.rf.santos@gmail.com>
2018-02-26 13:05:53 +00:00
Ed Costello
2a0c7c4331 Fix documentation of validate_certificates option in aws doc_fragment.
Unignore sanity test failures for AWS modules caused by this common
fragment.
2018-02-23 13:21:44 -08:00
Pilou
07927f52ae filesystem: fix documentation (#36556) 2018-02-23 10:59:38 +00:00
Matt Clay
5b5cba5e50
Update more code-smell tests. (#36570)
* Enhance use-compat-six code-smell test.
* Enhance use-argspec-type-path code-smell test.
* Enhance replace-urlopen code-smell test.
* Enhance boilerplate code-smell test.
* Enhance no-underscore-variable code-smell test.
2018-02-22 08:08:29 -08:00
Matt Clay
891f4f3b2d
Upgrade more code-smell tests. (#36560)
* Enhance no-dict-* code-smell tests.
* Enhance no-basestring code-smell test.
* Enhance no-get-exception code-smell test.
* Enhance empty-init code-smell test.
* Enhance required-and-default-attribute test.
* Remove unused code-smell test.
2018-02-21 20:09:13 -08:00
Jordan Borean
ef4f8851dc
win_feature: better error handling to make it easier to debug issues (#36491)
* win_feature: better error handling to make it easier to debug issues

* removed ignroed pslint rules that are no longer needed
2018-02-22 11:33:48 +10:00
John R Barker
5d0ed38e3a
Fixup VMware module docs issues (#36409)
Fix various argspec vs documentation issue
2018-02-21 15:20:42 +00:00
Matt Clay
2b6ac4561b
Add support for enhanced code-smell tests. (#36332)
* Add support for enhanced code-smell tests:

- Path selection handled by ansible-test.
- Optional path filtering based on extension.
- Optional path filtering based on prefixes.
- Optional lint friendly output.

* Enhance no-assert code-smell test.
* Enhance no-tests-as-filters code-smell test.
2018-02-20 13:37:23 -08:00
Matt Clay
a9b58b84d8 Fix path handling in validate-modules sanity test. 2018-02-20 11:02:42 -08:00
ABond
591695932e Fix bug in DigitalOcean module_util (#36352) 2018-02-18 07:47:26 +05:30
Abhijeet Kasurde
5242914ae5
Fix digital ocean issues (#36347)
Remove module from ignore lists and some documentation fix in
digital_ocean_block_storage and digital_ocean module.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-02-17 22:48:52 +05:30
Matt Clay
ff922ac2ad Import sanity test for main() in Ansible modules. 2018-02-16 11:17:36 -08:00
John R Barker
365630df65
Update ignore to deal with renamed files (#36323) 2018-02-16 19:07:36 +00:00
Matt Clay
80b55e3742 Add missing validate-modules ignore entries. 2018-02-16 01:40:45 -08:00
Matt Martz
831a9d67d7 Arg spec doc comparison fixes (#36265)
* Ensure we merge doc fragments early, for comparisons

* Perform boolean conversion from arg_spec data too

* Update valdiate-modules ignore.txt due to recent changes
2018-02-15 22:49:11 +00:00
Matt Martz
50adc5409b Add several new doc<->arg_spec checks (#36247)
* Add several new doc<->arg_spec checks. See #18183

* Update ignore.txt for validate-modules
2018-02-15 20:34:40 +00:00
John R Barker
7dfa11cd8a Notice in 2.6 remove in Ansible 2.10 (#36191)
Update the list of allowed removed_in for modules
2018-02-14 09:24:18 -08:00
John R Barker
3e22efa0ba
Ensure docs are valid before checking deprecation (#36160) 2018-02-14 14:47:31 +00:00
John R Barker
17c0d3eae0
Fix more docs vs argspec (#36048) 2018-02-12 17:42:25 +00:00
Jordan Borean
a0178b79f1
win_uri: fixes (#35487)
* win_uri: moved away from Invoke-WebRequest and fixed multiple issues

* fixes from review
2018-02-07 20:58:47 +11:00
Pilou
54882d4715 dimensiondata: fix broken import (#35634)
* Fix broken import

* Remove never reached statements

exit_json and fail_json methods call sys.exit, subsequent statements
can not be executed.
2018-02-07 00:44:42 +01:00
Toshio Kuratomi
86242e6871
Enable wildcard import pylint (#35786)
* Wildcard imports should be taken care of.  Enable the pylint check for them
* Remove wildcard import code-smell test as we're now checking via pylint
* Add unused-wildcard-import as ignored in our compat code.

These three files use wildcard imports so that they can export
symbols in a compatible location.  The real code lives elsewhere.
So disable the pylint tests for the relevant sections of code.
2018-02-06 15:17:49 -08:00
Toshio Kuratomi
a5b80464df Fix packaging/os modules for wildcard imports and get_exception 2018-02-06 08:44:49 -08:00
Abhijeet Kasurde
1119709b56 Remove get_exception from modules
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-02-06 07:49:24 -08:00
Pierre-Louis Bonicoli
2646ea9b86 yum_repository: Python 3.7 error have been fixed
See 232dc7110c
2018-02-02 09:43:58 -08:00
Toshio Kuratomi
4a48fdba1d
Update code smell blacklists (#35621)
Update blacklist for get_exception, boilerplate, and no-wildcard.

f5, lenovo, and junos have updated their code.
2018-02-01 12:24:07 -08:00
Matt Clay
b9c5147be2
Move import sanity test files into own directory. (#35593) 2018-02-01 09:52:31 -08:00
Matt Clay
2d565d14ed Add pslint sanity test settings.
Globally ignore rule: PSUseShouldProcessForStateChangingFunctions
2018-01-31 06:31:05 -08:00
Jordan Borean
62b87bc925
change .encode to to_bytes (#35522)
ignore backup dir in test integration targets folder
2018-01-31 08:58:03 +10:00
Matt Martz
c282e4e00f
Replace LooseVersion comparison with int/float comparison. Fixes #35435 (#35519) 2018-01-30 15:27:22 -06:00
Matt Martz
f659cc5963
Guard against assignments that are not ast.Name in docs parsing (#35513) 2018-01-30 12:56:16 -06:00
John R Barker
a23c95023b
Module deprecation: docs, scheme and tests (#34100)
Enforce module deprecation.
After module has reached the end of it's deprecation cycle we will replace it with a docs stub.

* Replace deprecated modules with docs-only sub
* Use of deprecated past deprecation cycle gives meaningful message (see examples below)
* Enforce documentation.deprecation dict via `schema.py`
* Update `ansible-doc` and web docs to display documentation.deprecation
* Document that structure in `dev_guide`
* Ensure that all modules starting with `_` have a `deprecation:` block
* Ensure `deprecation:` block is only used on modules that start with `_`
* `removed_in` A string which represents when this module needs **deleting**
* CHANGELOG.md and porting_guide_2.5.rst list removed modules as well as alternatives
* CHANGELOG.md links to porting guide index

To ensure that meaningful messages are given to the user if they try to use a module at the end of it's deprecation cycle we enforce the module to contain:
```python
if __name__ == '__main__':
    removed_module()
```
2018-01-30 12:23:52 +00:00
Jordan Borean
4da19f2d6b Added code-smell check to verify filenames are allowed with Windows (#35436) 2018-01-29 13:46:02 -08:00
Matt Clay
7abdab6c9e Convert ansible-test compile into a sanity test. 2018-01-25 09:45:36 -08:00
Pilou
0ce8d389a4 azure_rm_dnsrecordset: fix broken import and minor updates (#34983)
* fix broken import

Error was:
lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset.py:223:0: NameError: name 'ARecord' is not defined

* doc: use formatting functions

* remove unused dict
2018-01-25 09:39:49 -08:00
Dag Wieers
417accf88d Skip parameters that are being deprecated (#35319)
* Skip parameters that are being deprecated

So in most cases when parameters are deprecated, you may not want to
advertise them in the documentation. One reason for this is because
these parameters were not introduced within Ansible but predate
upstreaming them.

So this change avoids reporting parameters that are not documented and
are deprecated. It's only a small subset of the existing E322 errors.

* Add support for E323 with these changes

* Unsure about the other issues now

* Add better error message with E321

* Restore some erroneously remove files

* Readd false positives to ignore.txt
2018-01-25 11:10:49 -06:00
Matt Clay
e0010f15e4 Add pslint sanity test. (#35303)
* Add pslint sanity test.

* Fix `no-smart-quotes` sanity test.

* Add docs for `pslint` sanity test.
2018-01-24 17:22:14 -08:00
Matt Clay
cc65636a10 Add PSScriptAnalyzer to default container. 2018-01-24 08:36:28 -08:00
Colins-Git
7fac5cd7d2 Support for creation and modification of bridge and bridge slaves for nmcli (#34071)
Fixes: #31737
2018-01-24 11:00:09 +05:30
Dag Wieers
46e53f90a7
ACI: Rename aci_intf_policy_* to aci_interface_policy_* (#35170)
* ACI: Rename aci_intf_policy_* to aci_interface_policy_*

* Modify documentation accordingly

* Fix validity ignore file
2018-01-22 12:40:15 +01:00
Dag Wieers
fa5adabcbf
aci_rest: Additional notes and simplify examples (#35091)
Add additional notes, improve examples
2018-01-21 10:59:08 +01:00
Tim Rupp
ca8982f96c
Fixes some bugs and things (#35122)
Removes deprecations and fixes bugs.
2018-01-20 10:40:20 -08:00
Matt Martz
f9c2c9570d
Clean up imports to prevent issues with mutable data being used in modules (#35112)
* Clean up imports to prevent issues with mutable data being used in modules

* Remove un-needed mock
2018-01-19 16:33:16 -06:00
Matt Martz
3742ff9230
Fix CaptureStd in validate-modules to work on both py3 and py2 (#35060) 2018-01-18 14:50:31 -06:00
Dag Wieers
2fd5a99989
ACI: Fix validate-module tests E322 and E323 (#35052) 2018-01-18 19:18:43 +01:00
John R Barker
9a32f5c889 Add missing extends_documentation_fragment (#35013)
NXOS modules need more work, though that will all be in
module_docs_fragments/nxos.py
2018-01-17 16:31:53 -05:00
Matt Martz
3c400c5899
ANSIBLE_METADATA doesn't support YAML currently, change 315 to invalid data type (#35009) 2018-01-17 14:15:22 -06:00
Matt Martz
a352d43824
Compare arg+aliases between docs and argument_spec (#34809)
* compare arg+aliases between docs and argument_spec

* Add some special handling for the network modules provider options that also appear in the top level arg spec

* Fix error code for bigip_hostname

* Address merge conflicts due to changes in f5 modules

* Update validate-modules ignore based off a clean execution

* Address merge conflicts

* Address renamed module

* Address recent changes to modules

* Add ignore for ucs_ip_pool

* Update aci modules to get more reliable documentation comparison, but not mutating the module_utils aci_argument_spec

* Update ignore.txt after recent aci updates

* Add extra guard to ensure we handle provider special only for network modules

* Address additional changes to modules
2018-01-17 10:11:30 -06:00
Matt Clay
227ff61f9d
Add module support to yamllint sanity test. (#34964)
* Add module support to yamllint sanity test.
* Fix duplicate keys in module RETURN docs.
* Fix syntax in return_common docs fragment.
* Fix duplicate keys in module EXAMPLES docs.
2018-01-16 15:08:56 -08:00
Brian Coca
bbd6b8bb42 Temporary (#31677)
* allow shells to have per host options, remote_tmp

added language to shell
removed module lang setting from general as  plugins have it now
use get to avoid bad powershell plugin
more resilient tmp discovery, fall back to `pwd`
add shell to docs
fixed options for when frags are only options
added shell set ops in t_e and fixed option frags
normalize tmp dir usag4e

- pass tmpdir/tmp/temp options as env var to commands, making it default for tempfile
- adjusted ansiballz tmpdir
- default local tempfile usage to the configured local tmp
- set env temp in action

add options to powershell
shift temporary to internal envvar/params
ensure tempdir is set if we pass var
ensure basic and url use expected tempdir
ensure localhost uses local tmp
give /var/tmp priority, less perms issues
more consistent tempfile mgmt for ansiballz
made async_dir configurable
better action handling, allow for finally rm tmp
fixed tmp issue and no more tempdir in ballz
hostvarize world readable and admin users
always set shell tempdir
added comment to discourage use of exception/flow control

* Mostly revert expand_user as it's not quite working.

This was an additional feature anyhow.

Kept the use of pwd as a fallback but moved it to a second ssh
connection.  This is not optimal but getting that to work in a single
ssh connection was part of the problem holding this up.

(cherry picked from commit 395b714120522f15e4c90a346f5e8e8d79213aca)

* fixed script and other action plugins

ensure tmpdir deletion
allow for connections that don't support new options (legacy, 3rd party)
fixed tests
2018-01-15 21:15:04 -08:00
Matt Martz
19ab882790
Fix inconsitencies between code assumptions and schema (#34901)
* Fix inconsitencies between code assumptions and schema

* Address a couple of RETURN issues, where the description was parsed as a dict
2018-01-15 18:29:20 -06:00
jctanner
b10d5f34ea Extend validate-modules to check the next to last line (#34819)
* Add validation for the next to last line of a module

* Fix last error code

* Reduce to a single conditional

* Fix conditionals

* Move the final warnings statement to main() in mysql_replication
2018-01-15 15:49:35 +00:00
Tim Rupp
c548ab0f18
Refactors and deprecation removals (#34830)
This patch is primarily a refactor to make the validate-modules arg-spec
no longer generate a traceback. It additionally includes removal of deprecated
code in the virtual server module.
2018-01-12 23:03:41 -08:00
Tim Rupp
a10aee0fc3
Adds refactors for more f5 modules (#34824)
The main patch is to remove the traceback generating code. There are
other small fixes that were made in addition to doing that.

* Removed re-def of cleanup_tokens.
* Changed parameter args to be keywords.
* Changed imports to include new module_util locations.
* Imports also include developing (sideband) module_util locations.
* Changed to using F5Client and plain AnsibleModule to prevent tracebacks caused by missing libraries.
* Removed init and update methods from most Parameter classes (optimization) as its now included in module_utils.
* Changed module and module param references to take into account the new self.module arg.
* Minor bug fixes made during this refactor.
2018-01-12 21:49:12 -08:00
Tim Rupp
0e4e7de000
Various F5 related fixes for traceback raising (#34820)
The main purpose of this patch is to do the refactor that
supports replacing tracebacks with fail_json. Additionally, the
following was done.

* Removed re-def of cleanup_tokens.
* Changed parameter args to be keywords.
* Changed imports to include new module_util locations.
* Imports also include developing (sideband) module_util locations.
* Changed to using F5Client and plain AnsibleModule to prevent tracebacks caused by missing libraries.
* Removed init and update methods from most Parameter classes (optimization) as its now included in module_utils.
* Changed module and module param references to take into account the new self.module arg.
* Minor bug fixes made during this refactor.
2018-01-12 14:43:35 -08:00
Tim Rupp
eace686044
Various fixes and changes for F5 (#34817)
Primarily, this patch contains refactors to remove tracebacks that
are generated when libraries are missing. There is also,

* Removed re-def of cleanup_tokens.
* Changed parameter args to be keywords.
* Changed imports to include new module_util locations.
* Imports also include developing (sideband) module_util locations.
* Changed to using F5Client and plain AnsibleModule to prevent tracebacks caused by missing libraries.
* Removed init and update methods from most Parameter classes (optimization) as its now included in module_utils.
* Changed module and module param references to take into account the new self.module arg. Minor bug fixes made during this refactor.
2018-01-12 13:23:19 -08:00
Tim Rupp
44a5b3abb4
Various fixes (#34815)
This patch was primarily an effort to reduce traceback errors for
work that sivel was doing. Part of (and in some cases in addition to)
that, the following was done.

* Removed re-def of cleanup_tokens.
* Changed parameter args to be keywords.
* Changed imports to include new module_util locations.
* Imports also include developing (sideband) module_util locations.
* Changed to using F5Client and plain AnsibleModule to prevent tracebacks caused by missing libraries.
* Removed init and update methods from most Parameter classes (optimization) as its now included in module_utils.
* Changed module and module param references to take into account the new self.module arg.
* Minor bug fixes made during this refactor.
2018-01-12 12:08:49 -08:00
Dag Wieers
628eca85c3
ACI: Fixing new pylint issue (#34775) 2018-01-12 08:07:59 +01:00
Dag Wieers
83b7ec69fc
Fix pylint issue (#34773) 2018-01-12 02:26:14 +01:00
Dag Wieers
03dd3214b4
Fix new pylint issue (#34772)
Is it all worth it ?
2018-01-12 02:25:03 +01:00
Pilou
00332a49d5 ec2_win_password: fix broken import and minor updates (#34479)
* fix broken import

* ansible.module_utils.ec2.HAS_BOTO is already used

* wait_timeout parameter: use 'int' type

* wait is always True there

* doc: use formatting function
2018-01-12 11:24:46 +10:00
Matt Martz
dcc05093db Validate modules arg spec fixes (#34477)
* Update validate-modules arg_spec introspection to be faster, by only mocking the imports we explicitly list
* The use of types.MethodType in redhat_subscription wasn't py3 compatible, use partial instead
* Remove argument_spec import hacks, make them errors, we can ignore them with ansible-test
* Enable the --arg-spec flag for validate-modules
2018-01-11 15:41:53 -08:00
Matt Clay
96e5cce5ea Ignore pylint errors. 2018-01-11 15:38:35 -08:00
Matt Clay
74ac1c2e4a Test cleanup. 2018-01-11 13:43:10 -08:00
Matt Clay
2d4a43bb0a
Add file+rule ignore support to validate-modules. (#34757)
* Clean up code.
* Add file+rule ignore support to validate-modules.
2018-01-11 13:36:08 -08:00
Kedar Kekan
08957cf46e
cliconf and netconf refactor of iosxr_logging (#34495)
* * cliconf and netconf refactor of iosxr_logging

* * documentation issue fix

* * adds required_if and mutually_exclusive in arg spec
2018-01-11 10:08:11 +05:30
Matt Clay
513e0547b9 Fix version_added validation when empty. 2018-01-10 14:44:21 -08:00
Matt Clay
784360385e Remove already fixed Python 3.7 pylint ignores. 2018-01-10 14:08:11 -08:00
Matt Clay
797664d9cb Python 2.6 str.format() compatibility fixes. 2018-01-10 14:08:11 -08:00
Chris Houseknecht
623ff39443
Separate common and raw (#34563) 2018-01-09 07:22:46 -05:00