Commit Graph

175 Commits (9f899f94924fafeb330b1e8b18c970742da56e0d)

Author SHA1 Message Date
Matt Clay 9f899f9492
Require `from __future__ import annotations` (#81902) 8 months ago
Abhijeet Kasurde 4b7705b07a
Remove deprecated APIs from ansible-doc (#81729)
* Removed add_collection_plugins
* Removed find_plugins

Fixes: #81716

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
9 months ago
Felix Fontein b1b029c6b5
ansible-doc: allow to filter by more than one collection (#81450)
Make collection filters more flexible for listing collections.
Co-authored-by: Maxwell G <maxwell@gtmx.me>
9 months ago
Matt Clay 2cd1744be3
Use ansible.module_utils.common.text.converters (#80704)
Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
1 year ago
Felix Fontein 0e509ecf25
Support role extension for semantic markup. (#80305) 1 year ago
Felix Fontein b398613120
Add support for plugin field in seealso. (#80212) 1 year ago
Felix Fontein fafb23094e
ansible-doc: fix broken seealso links in text output (#80280)
* Fix broken URLs.

* Also remove auto-generated description for modules outside ansible.builtin.
1 year ago
Felix Fontein a2dc5fcc7d
Implement semantic markup support for Ansible documentation in ansible-doc. (#80242) 1 year ago
Felix Fontein 1705ec98cd
ansible-doc and validate-modules: remove underscore deprecation handling for collections (#79362)
* Remove underscore deprecation handling for collections.

* Also consider ansible.legacy.
2 years ago
Brian Coca 3b937123d2
final docs for filters (#78800)
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Felix Fontein fa093d8adf
ansible-doc: remove manual formatting (#78668)
* remove manual formatting and make the output align closer with the original YAML

Co-authored-by: Brian Coca <brian.coca+git@gmail.com>
2 years ago
Brian Coca eb17ab8c27
ansible-doc consistent version info ignore (#78725) 2 years ago
Brian Coca dc2a79f1c3
ansilbe-doc fixes for filters/test listing (#78696)
* split filters
* listing fixes
* return to no docs being exception
2 years ago
Brian Coca 4260b71cc7
refactor and fixes for doc parsing (#77719)
* refactor and remove redundant code in documentation

  allow location and building api to be more accessible
  fix issues with displaying ansible.legacy and ansible.builtin
  ensure we don't x2 process tokens (some modules reference them also) fixes #77764
  move to constants vs hardcoded
  more informative errors and comments
  now have actual filter/test plugins, which expose the filter/test functions
  moved filter/test loading/finding logic into jinja2pluginloader, removed dupe implementations
  added tests for case in which we unique by basename when listing

Update lib/ansible/utils/plugin_docs.py
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Brian Coca 0c57734819
until is also implicit (#78632)
The until keyword templating is also implicit, this will now reflect in the docs
2 years ago
Brian Coca d26801e994
Fix wording for :ref|term: substitution (#78216)
* Fix workding for :ref|term: subsitution

 now matches 'seealso' and makes more sense:

  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with `until`.
  ```
 vs
  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with website for `until`.
  ```

* updated unit tests

* match see also

* more sanity
2 years ago
Martin Krizek 43153c5831
`FieldAttribute`s as descriptors (#73908) 2 years ago
Brian Coca a12e0a0e87
ansible-config added json/yaml output to list/dump (#77447)
fixes #733644
2 years ago
Brian Coca 749a105956
ansible-doc stay 3.8 python compatible (#77682)
pathlib with_stem will wait till 3.9
  also add tests by listing filters
2 years ago
Brian Coca b439e41a91
expand ansible-doc coverage (#74963)
* Expand ansible-doc to tests/filters and fix existing issues

  enable filter/test docs if in single file or companion yaml
  add docs for several filters/tests plugins
  allow .yml companion for docs for other plugins, must be colocated
  verify plugins are valid (not modules, cannot)
  fix 'per collection' filtering
  limit old style deprecation (_ prefix) to builtin/legacy
  start move to pathlib for saner path handling
  moved some funcitons, kept backwards compat shims with deprecation notice

  Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
  Co-authored-by: Felix Fontein <felix@fontein.de>
  Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Felix Fontein babc26adc1
Handle errors during ansible-doc --metadata-dump more gracefully (#77035)
* Add option --no-fail-on-errors to return errors for ansible-doc --metadata-dump in JSON result instead of failing.

* Adjust changelog fragment.

* Add basic tests.
2 years ago
Matt Clay f68c66a3ef Remove collections compat from controller code. 2 years ago
Brian Coca 29b5eb6ba9
updated metadata dump to do full docs dump (#76170)
* minor refactor in other options by pushing common code into functions
 * consolidate coll_filter
 * more normalizing loader
 * dont pass plugin_loader, its global import
 * Also dump roles and collections
 * adjusted tests to new err msg
 * disable namespace filter (unused)
2 years ago
Brian Coca 864c2591b6
Use explicit keyword for plugin config (#75158)
* go back to keyword being explicit for plugin configs instead of using option name as implicit match
* switch spec to singular, no changes needed since no one used
2 years ago
Richie B2B 1b34933414
Fix ansible-doc -l ansible.builtin / ansible.legacy (#76235) 3 years ago
Martin Krizek 0f95371131
Start of moving away from six (#75863)
ci_complete
3 years ago
Matt Martz 66a83314b9
Modernize install (#76021)
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
3 years ago
Brian Coca 3d83c325dd
Fix metadump (#75668)
* ensure dump produces json

* clog and tests

* remove library additions since they are not usable

* avoid any/all dirs

* ensure we dont use local dir as playbookdir
3 years ago
Toshio Kuratomi b37a0630da
Revert "use versioned doclink for url references (#74245)" (#74782) 3 years ago
Brian Coca 214f0984a9
Dump keyword data (#75446)
* Add keywords to ansible-doc dump

  also fixed issue with async
3 years ago
Toshio Kuratomi a4021977ad
Fix structure of generic snippet feature (#74932)
* Fix struture of cli/doc.py snippet code.

A couple releases ago, cli/doc.py was modified to mostly conform to the
data processing pipeline steps.  format_plugin_doc() was the biggest
exception in that refactor.  When the snippet code was made generic
instead of being only for modules, the new code should have conformed to
the data processing pipeline too.

* Move the decision to output a snippet to the run() method alongside
  the decision to output a listing versus plugin_docs.
* Move the test for invalid plugin_types to the run() method as it
  affects all snippets in this run, not just a single snippet. (-t can
  only be specified once)
* Rename get_snippet_text() to format_snippet() as:
  * This is the data formatting step
  * The format_snippet() name matches with its conceptual sibling,
    format_plugin_doc().
* Use ValueError inside of format_snippet() to flag unrecoverable errors
  formatting a single snippet.
* Emit a warning when format_snippet() raises ValueError and continue to
  the next snippet.
* If the yaml(?) or toml inventory plugin is specified for snippet output,
  raise ValueError() so that the user sees a warning instead of simply
  seeing blank output.
* Do not modify arguments passed into format_snippet().  This is the
  formatting step so data should not be modified.
* Change _do_yaml_snippet() and _do_lookup_snippet() to operate side
  effect free.
* Fix raising of exceptions when formatting requred options for snippets.

* Unrelated: Use to_text() instead of to_native when calling
  display.warning(). to_native() is used for raising exceptions.  Not
  for display methods.

* Add a changelog
3 years ago
Felix Fontein c404a9003f
ansible-doc: improve version_added handling (#73602)
* Output version_added on top level, and improve version_added formatting

* Handle 'historical' version_added.
3 years ago
Felix Fontein 58450f041a
Do not show empty version_added_collection values in ansible-doc text output. (#74999) 3 years ago
Brian Coca 1c4ca154fa
improve inv plugin selectino for snippets (#74933)
* improve inv plugin selectino for snippets
* add warning on no snippet for inventory
3 years ago
Brian Coca 6d2398db28
expand doc snippets to lookups and other plugins (#74403)
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
3 years ago
Brian Coca 26827f5039
ansible-doc fix displaying 'CLI' options for plugin docs
cli options will now display either use provided info, or automating from the name


Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Brian Coca ddaa539ab1
Better handling of rstisms in ansible-doc (#74596)
* Better handling of rstisms

  replace tags more intelligently to make things more readable
  unit tests + minor adjustments
3 years ago
David Shrewsbury 8fb54885bf
Role argspec: allow new argument spec file (#74582)
* support separate role argspec file in ansible-doc

* support separate role argspec file in ansible-core

* support both .yml and .yaml extensions on argspec file in ansible-doc

* fix filename building bug and rename some argspec files to test variations

* use yaml extensions from constants

* add superfluous meta/main.yml files to tests

* Update lib/ansible/cli/doc.py

Co-authored-by: Sam Doran <sdoran@redhat.com>

* update docs

* ci_complete

* add changelog and allow for main.yml variations

* add collection role testing

Co-authored-by: Sam Doran <sdoran@redhat.com>
3 years ago
Brian Coca c1879a5011
use versioned doclink for url references (#74245)
* use versioned doclink for url references

Co-authored-by: Felix Fontein <felix@fontein.de>
3 years ago
Matt Martz bf7d4ce260
Abstract away libyaml details into yaml utils (#72607)
* Add yaml utils file and use it

* Linting fix and missing import

* Abstract a few more details

* Parser imports

* Don't use CSafeDumper in AnsibleDumper

* Move and use convert_yaml_objects_to_native when libyaml is present

* yaml_load and yaml_dump, instead of safe_*

* re-use HAS_LIBYAML from utils.yaml

* add changelog fragment

* Address recent changes

* Use representer instead of recursive type converter

* Restore needed import

* move yaml utils to module_utils

* Properly guard imports

* Update from_yaml(_all)? to handle text wrappers with CSafeLoader

* Use yaml utils for legacy_collection_loader

* Add HAS_YAML, and ignore pylint issue

* oops

* GPL->BSD
3 years ago
Brian Coca 07939b04f3
[2.12] 'attributes' (#73707)
* wip 'attributes'

* added version added tests

* syntzx

* not bile

* correztlys merges

* moved desc to frag

* simpler as dict

* unused

* clog

* Update lib/ansible/utils/plugin_docs.py

Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>

* unnoted

* added action plugins

* longer list

* add sttri schema

* huh?

* itsdict

* dictit

* yolo

* gnore for now

* moar attribs

* allow extras

* positive

* added loop, documented 'imports'

* support is now none/partial/full

* import_playbook is outside host loop

Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
3 years ago
Sam Doran 18f7282ccf
ansible-doc - account for empty meta/main.yml (#73590)
* ansible-doc - account for empty meta/main.yml

 from_yaml() will return None when encrounting an empty file.
3 years ago
David Shrewsbury 3a18ef7159
Change role argspec file used by ansible-doc (#72927)
* Change role argspec file used by ansible-doc

This changes the file used for role argument specs from meta/argument_specs.yml
to meta/main.yml. The argument specs are expected to be in that file under the
top-level entry of `argument_spec`.

* Switch to argument_specs
4 years ago
David Shrewsbury be2c376ab8
Extract embedded function to RoleMixin method and add tests (#72754)
* Add changelog
* Simplify return
4 years ago
David Shrewsbury 0fa1cd88ce
ansible-doc: replace DataLoader with from_yaml (#72686)
* Replace DataLoader with pure yaml
4 years ago
David Shrewsbury 570aed0913
ansible-doc role arg spec support (#72120)
* Support listing roles in text and JSON

* Change tests for unfrack'd playbook_dir var

These tests were using '/tmp' for testing the setting of the playbook_dir
var. Now that we unfrack that var, MacOS will change this to '/private/tmp'
causing the tests to fail. We can choose a path that does not exist (since
unfrack does not validate existence) so that we can guarantee unfracking
will not change the value.
4 years ago
Brian Coca 8eab113cb1
show keyword documentation in ansible-doc (#72476)
* show keyword documentation in ansible-doc

Co-authored-by: Felix Fontein <felix@fontein.de>
4 years ago
Brian Coca 4b673484f0
rethink wording (#70028)
* rethink wording
* removed unrequired requirement
* fix tests
* fixed versions
Co-authored-by: Sloane Hertel <shertel@redhat.com>
4 years ago
Felix Fontein 4fb336cef1
ansible-doc: export has_action when --json is used (#72359)
* ansible-doc: export has_action when --json is used.
* Remove docuri and now_data, which were not used resp. ignored in format_plugin_doc and the functions it calls anyway.
* Add function _combine_plugin_doc.
4 years ago
Felix Fontein 0c3a9c7ae6
ansible-doc: show correct plugin name (#71966) 4 years ago