Commit Graph

759 Commits (56d142350d62fb674e1c6874b3ace2cf5cb933a7)

Author SHA1 Message Date
Matt Martz 56d142350d
Add support for importlib.resources (#78915)
* Add support for importlib.resources

* Remove the importlib.resources imports

* return the correct data

* Some code comments, and re-order for consistency

* Disallow traversing packages below an individual collection

* Add a traversable class for namespaces

* Re-use variable

* Utilize itertools.chain.from_iterable

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Simplify logic to check for packages from ansible loaders

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Just a generator expression, instead of a generator

* docstrings

* Add comment about find_spec for our namespaces

* Add some initial unit tests for importlib.resources

* normalize

* Utilize importlib.resources for listing collections

* collections_path is already in config, just use config

* install uses a different default for collections_path

* Remove unused import

* Remove duplicate __truediv__

* Bring back TraversableResources

* Apply some small suggestions from code review

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Remove cross contamination between plugin loader code and CLI code

* Remove unused import

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
1 year ago
Sloane Hertel acbf4cc60e
ansible-galaxy - fix turning off the ConcreteArtifactManager's validate certs at the global level (#79561)
Fix ignoring certs when downloading tarballs

Fix ignoring certs when downloading a collection from a specific source that isn't in the configured servers list
1 year ago
Sloane Hertel fd325c00bd
ansible-galaxy collection|role init - fix preserving symlinks (#79134)
* Preserve symlinks in custom role/collection skeletons

* changelog
1 year ago
Brian Coca 5b51b560d0
Removed sorting to preserve original order (#74839)
updated tests to reflect new order
2 years ago
Sloane Hertel 01ff57bdff
add ansible-galaxy cli documentation for parallel execution (#79433)
* add ansible-galaxy cli documentation for parallel execution

Co-authored-by: saranti <tsarantis@proton.me>

* Update lib/ansible/cli/galaxy.py

* Update lib/ansible/cli/galaxy.py

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: saranti <tsarantis@proton.me>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
saranti b7ea661807
Update pull.py (#79387) 2 years 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
Sloane Hertel da3a7618ba
give a warning when no roles match the search instead of returning rc 1 (#79195)
* give a warning when no roles match the search instead of returning rc 1

* porting guide note

* Update docs/docsite/rst/porting_guides/porting_guide_core_2.15.rst

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Sloane Hertel cb2e434dd2
ansible-galaxy install - fix unnecessary api check when installing a role from git repo (#79090)
* delay server api evaluation until a GalaxyRole needs to make an api call for info, list, and install
2 years ago
Brian Coca 27ab589ee8
ansible-config, only subvalues should use yaml shorthand (#79073)
* ensure we only use shorthand for assigned values

* fix ansible-config std display

* split baby

* killed offending whitespace

* moved to func instead

* the revenge of whitespace
2 years ago
Dmytro Khomutnyk b5db71e318
ansible-vault: add newline to the output of the 'encrypt_string' command (#79017)
* ansible-vault: add newline to the output of the 'encrypt_string' command

* Add comment with issue description and improve string joining

* Add changelog fragment

* Update changelogs/fragments/79017-ansible-vault-string-encryption-ending-with-newline.yml

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Fixed some typos in changelog fragment

* Improve comment regarding newline character at the end of file

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Brian Coca 4b0697ee03
make pager and editor configurable, specifically for ansible (#78816)
* make pager and editor configurable, specifically for ansilbe

  fallback on common ways to configure
2 years ago
Brian Coca 3b937123d2
final docs for filters (#78800)
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Brian Coca b1ff0f4ebc
vault secrets file, keep context when symlink (#78734)
* vault secrets file, keep context when symlink

	fixes #18319

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sloane Hertel a02e22e902
Add --offline option to 'ansible-galaxy collection install' (#78678)
* Add --offline option to 'ansible-galaxy collection install' to prevent querying distribution servers

This allows installing/upgrading individual tarfiles to have dependency resolution.
Previously needed to be done manually with --no-deps or else all collections and dependencies needed to be included in the requirements.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
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
Matt Martz 4c8b8a06be
Fix exit codes for role search and delete. Fixes #78516 (#78578) 2 years ago
Kate Case bf1ef5a1f3
Replace get_persistent_connection_options in task_executor with get_options (#74446)
Replace get_persistent_connection_options with get_options
Remove special case for network sub_plugin in _set_plugin_options
Try to avoid mock connection pretending to be persistent
Rename variables->options to reflect what they actually are
Gather options for ssh_type_conn on network_cli
Drop reliance on sub_plugin["type"]
2 years ago
Matt Clay 09d0df1d87
Fix variable use before definition. (#78500)
* Fix variable use before definition.

* Include mkstemp in exception handler.

Also remove two pointless variable assignments.
2 years ago
Matt Martz 86298b7a47
Fix --role-file arg detection (#78475)
* Fix --role-file arg detection. Fixes #78204

* Do not traceback, give better error

* Add coverage for compound shortopts to match -r. Fixes #78491
2 years ago
Brian Coca 740864869e
ansible-config init fixes (#78453)
* ansible-config init fixes

  now handles --disabled correctly for 'vars' format
  also does not display internal config entries anymore

  fixes #78438

note plugins have _prefixed settings that are public, this should change
2 years ago
Matt Clay c35a36083d
ansible-console - Fix arg name to match base class. (#78502) 2 years ago
Matt Clay 650befed37
Add missing space after keywords. (#78480)
Also remove unnecessary parenthesis.
2 years ago
Jordan Borean ad79c1e0d0
Add support for json in adhoc -a (#78114)
Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Sloane Hertel 05608b20e8
Fix listing collections that are missing the metadata required by build (#76596)
* Rethread pr/70185 through the dependency resolver

Hang optional metadata toggle on the ConcreteArtifactsManager instead of threading it through whole list codepath

Don't error while listing collections if a collection's metadata is missing keys required for building a collection.

Give an informative warning if metadata has been badly formatted.

Co-authored-by: Sam Doran <sdoran@redhat.com>
2 years ago
Sloane Hertel a2174fc6d9
Fix removing existing dir/files with `ansible-galaxy collection init --force` (#78403)
* Remove collection contents when re-initializing with --force


Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Matt Martz 884244f1b2
Python 3.9 min for controller (#77566) 2 years ago
Matt Martz b1dd2af4ca
Preflight utf8 encodings check (#78175) 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
Matt Martz bcdc2e167a
Support for Python 3.11+ tomllib for inventory (#77435) 2 years ago
Martin Krizek 43153c5831
`FieldAttribute`s as descriptors (#73908) 2 years ago
Brian Coca fa35aa4865
Galaxy server config updates (#77106)
* ansible-galaxy configurable timeouts

  - also fixed issues with precedence,
    so --ignore-certs now overrides config
  - made galaxy_timeout generic setting,
    if set, it becomes default for server configs,
    but now specific servers can override
  - updated tests or added notes (some tests ignore/override precedence)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Brian Coca 34f8168afc
ansible-console fixes (#78064)
* list collection task actions too
* dynamically add execute/help functions when module is found
* handle redirection and short names
2 years ago
Sloane Hertel 1214b63f4f
Fix 'ansible-config dump --only-changed -t all' verbosity (#77898)
* Fix 'ansible-config dump --only-changed -t all' to only display headers if plugin options are changed

* changelog

* add a test
2 years ago
Sloane Hertel 400475acc0
validate meta/main.yml dependencies and meta/requirements.yml are both lists before concatenating them together (#77821) 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
Matt Clay f7c2b1986c Require blocking IO for ansible CLI. 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
Brian Coca af9f628ab5
Add python path to version output (#77631)
To further disambiguate 'which' python is the correct python
2 years ago
Matt Clay 6fdec4a6ab Revert "Require blocking IO for ansible CLI. (#77639)"
This reverts commit e2d54d3594.
2 years ago
Matt Clay e2d54d3594
Require blocking IO for ansible CLI. (#77639) 2 years ago
code-review-doctor 578a815271
Fix issue probably-meant-fstring found at https://codereview.doctor (#77619) 2 years ago
Brian Coca abdd237de7
Yolo (#77554)
* Revert "Revert "Config, ensure templating happens at functions (#77483)""

This reverts commit 94c9106153.

* removed update configdata, which is unused
* removed test for action we don't perform anymore
* removed unused configdata
2 years ago
Matt Clay 94c9106153 Revert "Config, ensure templating happens at functions (#77483)"
This reverts commit 6e5f1d781d.
2 years ago
Brian Coca 793bb200ec
CLI now issues clearer error when 0 hosts selected (#77517)
fixes #77512
2 years ago