Commit Graph

681 Commits (43d09710c81f36113fec8d68e650a6b6d82dca05)

Author SHA1 Message Date
jbpratt 3add434269
add missing space to `--playbook-dir` help string (#76062) 3 years ago
Jeremy Kimber 827981c7dd
Add support for distinct collection skeleton configuration (#75845)
Signed-off-by: Jeremy Kimber <jeremy.kimber@garmin.com>

Co-authored-by: Jeremy Kimber <jeremy.kimber@garmin.com>
3 years ago
Martin Krizek f774292439
cli - remove deprecated setting verbosity before sub command (#75840)
* cli - remove deprecated setting verbosity before sub command

Fixes #75823

* Fix tests
3 years ago
Matt Martz 79e9dae292
Don't show params when there is an issue with `set_option(s)` (#75805) 3 years ago
Matt Martz 724800cd3f
Python 3.8 Controller Minimum (#74013) 3 years ago
Chris Hambridge 1353678f23
Enable ansible-galaxy to specify client id override with Keycloak Token (#75601)
* Enable ansible-galaxy to specify client id override with Keycloak Token

* Specify ability to provide override of client_id

* Test client_id can be configured for individual servers

* Add issue link to changelog

* Document client_id as a config option and add an example

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Sloane Hertel 72ba2bdc82
ansible-galaxy - add a per-server validate_certs option (#75710)
* Add a validate_certs option to galaxy server configuration

* Add a unit test for cert validation

* changelog
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 ff72908b4d
Fix --list-hosts when undefined var is used (#75533)
fixes #75354
3 years ago
Brian Coca b554aef3e1
More options for password passing (#73117)
* add 'file options' for become and connection pass
* implemented getting passwords from file or script
* added config entry
* fixed env var name and noted executable behaviuor

Co-authored-by: Rick Elrod <rick@elrod.me>
3 years ago
Brian Coca 214f0984a9
Dump keyword data (#75446)
* Add keywords to ansible-doc dump

  also fixed issue with async
3 years ago
Brian Coca 7a9246a219
ansible-pull, restore repo options (#75491) 3 years ago
Brian Coca 22aa6dedc9
fix yaml version issue with config yaml dump (#75344)
now tests can run in other pythons (really yaml pkg versions)
  also cleaned up diff_failure for unimplemented flow
3 years ago
Brian Coca e5a2fe4c41
fix ssh cli defaults (#75245)
* fix ssh cli defaults

  fixes #75221
3 years ago
Brian Coca 60c9f045cc
Unfrack extra vars (#75127)
* Ensure we keep teh original path as per cli

  fixes #75126

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
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
Brian Coca 50b6d28ee1
Config init+ (#74914)
Can now specify plugin/plugin type for list and dump actions
 New 'init' action to create usable config sources 

Co-authored-by: Felix Fontein <felix@fontein.de>
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
David Shrewsbury 6539c59857
ansible-pull - update help info for --directory option (#74936)
* Update -d help info for ansible-pull

* fix pep8
3 years ago
Martin Krizek 5ac1b04929
Add support for unicode in ansible-inventory CLI (#74912)
* Add support for unicode in ansible-inventory CLI

Fixes #57378

* Add tests

* First test fix

* --output tests

* fix
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
Abhijeet Kasurde 8f82e6327f
ansible-cli: Remove unnessary trailing space (#74880)
Fixes: #74875

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.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 7f7d3067e3
adhoc clarify help (#74616)
also added comments to code
3 years ago
Abhijeet Kasurde 38dd49eb00
ansible-inventory: Handle exception in toml parsing (#74486)
Handle stacktrace raise while parsing inventory in toml format

Fixes: #74404

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
3 years ago
Rick Elrod b0389c7f11
[cli] remove superfluous trailing space from help (#74551)
Change:
- After we output the newline in help text, we also added a space. This
  caused either a space to show up before the shell prompt (in shells
  like bash), or " %" and a newline before the next prompt on shells
  like zsh that automatically force commands to end with a newline.
- This change removes the extra space, so that peace can be restored in
  the minds of many.
- This only showed up when running commands with no arguments or invalid
  arguments.

Test Plan:
- Ran `ansible`, `ansible -h`, `ansible-playbook`, `ansible-galaxy`, and
  `ansible-galaxy -h`.

Tickets:
- Introduced in #69458

Signed-off-by: Rick Elrod <rick@elrod.me>
3 years ago
Brian Coca 8a2fc854f4
Add plugin config lists (#49627)
* add plugin config lists
* and dump config for plugins
*  also list configs under PLUGINS for 'all' list
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
Brian Coca 85e7108d52
force version on deprecation (#74338) 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
Matt Martz 28a2d9b4ae
Remove __requires__ attribute for pkg_resources (#74294) 3 years ago
Richlv 8e5dc7306e
Typo fix in help output (#74277)
Should still fit in 80 chars
3 years ago
Matt Davis 454c7e37ec
nonzero exit code on `ansible galaxy collection verify` failures (#74051) 3 years ago
Matt Davis a84c1a5669
add --offline option to galaxy collection verify (#74040)
* --offline allows in-place verify for installed collections with manifests
* manifest hash, collection name, version, and path are now always displayed
* test updates
3 years ago
sommersoft 4add723107
ansible-pull: Run All Playbooks When Multiple Are Supplied (#73172)
* ansible-pull: run all playbooks when multiple are supplied

* add test for ansible-pull with multiple playbooks supplied from cli

* add changelog fragment
3 years ago
Brian Coca 935528e22e
finish migrating ssh plugin to config system (#73708)
* finish migrating ssh plugin to config system

  fixes #72739
  fixes #57220

* fix connection detection in reset
* correct options for connection meta reset

Co-authored-by: David Shrewsbury <Shrews@users.noreply.github.com>
3 years ago
Brian Coca 527bff6b79
Don't fail for mixed typed keys (#73726)
* Don't fail for mixed typed keys

  but warn that content cound not be sorted because of this

* added tests
3 years ago
ylmrx e7e3c12ad2
Fixes for ansible-console usability (#73665)
- Fix Ctrl+C/D behavior (#68529)
 - correct few typos and missing infos
 - Fixes doc (#72195)
3 years ago
Matt Davis d0e991e892
Clarify CLI version number as core version (#72287)
* clarify CLI version number as core version

* reduce confusion with `ansible` PyPI package >= 2.10 drifting from core version

* fix units
3 years ago
manas-init eb72c36a71
galaxy: Handle ignored directory names in role skeleton (#72035)
* galaxy: restore left hand slicing in assignment

Fix 'ansible-galaxy role init --role-skeleton=role-skeleton' when the role skeleton
contains an ignored directory.

The issue was because the 'dirs' variable was changed to reference a different list,
but needs to be mutated instead to stop os.walk from traversing ignored directories.

Fixes: #71977

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.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
Shane McDonald 67f5bb39c7
galaxy - add format options for collection list (#73474)
* Include all collections in single json object / yaml document
* Add tests
* For galaxy list yaml/json output, use dictionary of dictionaries instead of list
* Add tests for listing single collection in yaml / output format
* --output -> --format
* Add explicit test for listing collection in human format
* Fix bug where empty json object was emitted + add test
3 years ago
Sloane Hertel 9759e0ca49
add option to upgrade collections (#73336)
* Add a flag to ansible-galaxy to update collections


Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
3 years ago
Sviatoslav Sydorenko 595413d113
Replace the inhouse collection dependency resolver with `resolvelib`
PR #72591

This change:

  * Adds an artifacts manager that abstracts away extracting the
    metadata from artifacts, downloading and caching them in a
    temporary location.

  * Adds `resolvelib` to direct ansible-core dependencies[0].

  * Implements a `resolvelib`-based dependency resolver for
    `collection` subcommands that replaces the legacy
    in-house code.

    This is a dependency resolution library that pip 20.3+ uses
    by default. It's now integrated for use for the collection
    dependency resolution in ansible-galaxy CLI.

  * Refactors of the `ansible-galaxy collection` CLI.
    In particular, it:

      - reimplements most of the `download`, `install`, `list` and
        `verify` subcommands from scratch;

      - reuses helper bits previously moved out into external modules;

      - replaces the old in-house resolver with a more clear
        implementation based on the resolvelib library[0][1][2].

  * Adds a multi Galaxy API proxy layer that abstracts accessing the
    version and dependencies via API or local artifacts manager.

  * Makes `GalaxyAPI` instances sortable.

  * Adds string representation methods to `GalaxyAPI`.

  * Adds dev representation to `GalaxyAPI`.

  * Removes unnecessary integration and unit tests.

  * Aligns the tests with the new expectations.

  * Adds more tests, integration ones in particular.

[0]: https://pypi.org/p/resolvelib
[1]: https://github.com/sarugaku/resolvelib
[2]: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing

Co-Authored-By: Jordan Borean <jborean93@gmail.com>
Co-Authored-By: Matt Clay <matt@mystile.com>
Co-Authored-By: Sam Doran <sdoran@redhat.com>
Co-Authored-By: Sloane Hertel <shertel@redhat.com>
Co-Authored-By: Sviatoslav Sydorenko <webknjaz@redhat.com>

Signed-Off-By: Sviatoslav Sydorenko <webknjaz@redhat.com>
3 years ago