summaryrefslogtreecommitdiffstats
path: root/test/units/galaxy (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update triple single quotes to triple double quotes (#84099)Matt Clay2024-10-092-3/+3
| | | | | | | | | * Update triple single quotes to triple double quotes This change was fully automated. The updated Python files have been verified to tokenize the same as the originals, except for the expected change in quoting of strings, which were verified through literal_eval. * Manual conversion of docstring quotes
* Cover unit tests with mypy (#84084)Matt Clay2024-10-084-7/+5
| | | | | | | | | * Added support for testing unit tests with mypy. * Added support for ignoring individual mypy error codes. * Added missing assert on unit tests and marked xfail. * Added type hints for some unit tests. * Added ignores for unit tests not passing mypy. * Fixed incorrect autouse argument in unit test fixtures. * Fixed minor issues causing problems with mypy in unit tests.
* ansible-galaxy - fix ignoring certs when installing from git repos (#83332)Sloane Hertel2024-10-081-2/+38
| | | | | | | | | * Fix installing collections|roles from git repos with GALAXY_IGNORE_CERTS * Fix installing collections from git repos with --ignore-certs * Update unit test * Add test case
* Use sentinel everywhere (#84041)Abhijeet Kasurde2024-10-031-1/+1
| | | | | * Use sentinel everywhere Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Typo fixes and other bits and bobs (#83672)Lee Garrett2024-07-272-2/+2
| | | Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
* config, integrate dynamic galaxy servers (#83129)Brian Coca2024-05-292-6/+7
| | | Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
* Use of constant for 644 permission variable (#82762)Abhijeet Kasurde2024-03-053-11/+14
| | | Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* ansible-galaxy - fix exit code for failed role import (#82193)Sloane Hertel2023-12-121-1/+18
|
* Remove Python 2 compat (via six) from unit testsMatt Clay2023-11-023-8/+8
|
* Require `from __future__ import annotations` (#81902)Matt Clay2023-10-057-20/+7
|
* Make sure paths are treated correctly when building collection files ↵Carlos Camacho2023-09-201-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | manifest (#81619) * Make sure paths are correct when building collection files manifest This commit makes sure the path of the files part of the collection build manifest are correct. This commit uses os.path.commonprefix instead of dealing with strings. Signed-off-by: Carlos Camacho <ccamacho@redhat.com> Bugfix Pull Request Fixes: #81618 * Revert the change note type to `minor_changes` * Clarify the change note with user-oriented details --------- Signed-off-by: Carlos Camacho <ccamacho@redhat.com> Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* galaxy: Cross check the collection type (#81423)Abhijeet Kasurde2023-08-031-0/+21
| | | | | | | | | * User-provided collection type might differ from collection source. Cross-check the type before proceeding Fixes: #79463 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Consider all configured collection paths when installing collections (#81243)Sloane Hertel2023-07-211-3/+6
| | | | | | | | | * Only install collections which can't be satisfied by a collection in any of the configured paths. * Improve warning for unexpected collection install path Fix warning when path is configured, but is a pip-managed path Normalize the path before validating to fix warning consistency
* Add pymarkdown sanity test for core (#81220)Matt Clay2023-07-111-1/+1
| | | | | | | * Clean up markdown * Add pymarkdown sanity test for core * Update unit test SHA
* ansible-galaxy - add config option for the default ansible-galaxy timeout ↵Sloane Hertel2023-06-261-0/+50
| | | | | (#81108) allow configuring the default server timeout via env/ini
* Update galaxy_ng container for tests (#80721)Matt Martz2023-06-071-6/+0
|
* Improve code coverage of unit tests (#80904)Matt Clay2023-05-273-119/+20
| | | | | | | | | | | | | | | | | | | * Improve coverage of validate-modules unit tests * Remove unused galaxy unit test code * Fix galaxy unit test teardown logic * Improve coverage of galaxy unit test code * Improve coverage of galaxy unit tests * Remove unused code in galaxy API tests * Remove unused galaxy collection unit test code * Improve coverage of galaxy collection unit tests * Remove unused galaxy unit test code
* Use ansible.module_utils.common.text.converters (#80704)Matt Clay2023-05-035-5/+5
| | | Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
* Fix unit test asserts (#80500)Matt Clay2023-04-121-3/+3
|
* Clean up unused imports in unit tests (#79893)Matt Clay2023-02-032-3/+1
|
* Add support for importlib.resources (#78915)Matt Martz2023-01-102-102/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* ansible-galaxy - fix turning off the ConcreteArtifactManager's validate ↵Sloane Hertel2023-01-091-38/+60
| | | | | | | 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
* galaxy: Add license_file to manifest directives (#79420)Maxwell G2022-11-291-5/+5
| | | | | | | | | | * galaxy: Add license_file to manifest directives * ag collection build: Test license handling This adds tests to ensure that - REUSE licensing files: .reuse/dep5, LICENSES/*, anyfile.license - galaxy.yml license_file are always included in the manifest.
* Add --offline option to 'ansible-galaxy collection install' (#78678)Sloane Hertel2022-09-191-16/+19
| | | | | | | | * 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>
* Relax minimal config to enable manifest functionality (#78574)Matt Martz2022-08-181-5/+6
| | | | | * Revert "Fix incorrect docs about how to enable manifest functionality (#78572)" This reverts commit ac1ca40fb3ed0a0fce387ae70cb8937208a13e03.
* Use MANIFEST.in style directives to build collections (#78422)Matt Martz2022-08-171-5/+6
|
* Fix listing collections that are missing the metadata required by build (#76596)Sloane Hertel2022-08-021-0/+17
| | | | | | | | | | | * 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>
* Fix KeyError for ansible-galaxy when caching paginated responses from v3 ↵Sloane Hertel2022-07-211-0/+80
| | | | | | | | | | | (#78325) * Fix KeyError for ansible-galaxy when caching paginated responses from v3 * changelog * generate responses in loop for test Co-authored-by: Matt Martz <matt@sivel.net>
* Make unit test for missing git executable more generic (#78173)Sloane Hertel2022-06-301-3/+4
| | | | | * Make unit test for missing git executable more generic * use MagicMock side_effect to raise exception instead
* Galaxy server config updates (#77106)Brian Coca2022-06-241-3/+6
| | | | | | | | | | | | | * 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>
* Use unittest.mock instead of mock. (#77883)Matt Clay2022-05-234-4/+4
| | | This can only be done for controller tests.
* ansible-galaxy collection - ensure dependencies are a dict (#77561)Jack2022-04-191-9/+34
| | | * fix traceback when installing collection with dependencies set to None
* Make "~/.ansible" path configurable (#76114)htol2022-04-111-1/+1
| | | | | | | | | | * replace hardcoded '~/.ansible' to C.ANSIBLE_HOME * rename previously existing env ANSIBLE_HOME in env-setup script * modify cache dir monkeypatching in galaxy api unit tests * update "version_added" to 2.14 for ANSIBLE_HOME * fix description of collections with proper use of ANSIBLE_HOME Co-authored-by: htol <github@h-tol.net> Co-authored-by: stefanwascoding <stefan@syntaxhelden.de>
* Get git executable for collections in git repos (#77493)Sloane Hertel2022-04-081-4/+25
| | | * Fix traceback installing collections from git repos if git is not installed
* Fix type for ansible-galaxy server config definitions (#77424)Sloane Hertel2022-03-311-1/+67
| | | | | | | | | * Fix type for ansible-galaxy server config definitions * changelog * check attr without api call * pep8
* ansible-galaxy - add configuration options for more flexible collection ↵Sloane Hertel2022-03-232-1/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | signature verification (#77026) * Add a toggle to control the number of signatures required to verify the authenticity of a collection * Make the default number of required valid signatures 1 * Add option to make signature verification strict and fail if there are no valid signatures (e.g. "+1") * Use a regex to validate --required-valid-signature-count * Add a toggle to limit the gpg status codes that are considered a failure * Update documentation and changelog * Add unit and integration tests for the new options * Fixes #77146 Fix using user-provided signatures when running 'ansible-galaxy collection verify ns.coll --offline' Add a test for a user-provided signature when running ansible-galaxy collection verify with --offline Fix displaying overall gpg failure without extra verbosity Add a test for displaying gpg failure without verbosity Improve documentation to be more clear that signature verification only currently applies to collections directly sourced from Galaxy servers
* Remove obsolete units.compat.mock compat layer. (#77118)Matt Clay2022-02-234-4/+4
| | | | * Remove obsolete units.compat.mock compat layer. * Update remaining units.compat.mock references.
* ansible-galaxy - add signature verification of the MANIFEST.json (#76681)Sloane Hertel2022-02-102-32/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ansible-galaxy collection install|verify: - Support verifying the origin of the MANIFEST.json when the Galaxy server has provided signatures. - Allow supplemental signatures to use during verification on the CLI/requirements file. * ansible-galaxy collection install: - Support disabling signature verification. This silences the warning provided by ansible-galaxy if the Galaxy server provided signatures it cannot use because no keyring is configured. - Store Galaxy server metadata alongside installed collections for provenance. This is used by 'ansible-galaxy collection verify --offline'. * Add unit tests for method that gets signatures from a Galaxy server * Add integration tests for user-provided signature sources - Test CLI option combinations - Test installing collections with valid/invalid signature sources - Test disabling GPG verification when installing collections - Test verifying collections with valid/invalid signature sources * Make signature verification advisory-by-default if signatures are provided by the Galaxy server - Make the default keyring None - Warn if the keyring is None but the Galaxy server provided signatures - Error if the keyring is None but the user supplied signatures - Error if the keyring is not None but is invalid * changelog * add ansible-galaxy user documentation for new options Co-authored-by: Matt Martz <matt@sivel.net> Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> Co-authored-by: Martin Krizek <martin.krizek@gmail.com> Co-authored-by: Sandra McCann <samccann@redhat.com> Co-authored-by: Andy Mott <amott@redhat.com> Co-authored-by: John R Barker <john@johnrbarker.com>
* Expect upper case message 'levels' for galaxy publish results (#63530)Adrian Likins2022-01-121-8/+8
|
* ansible-galaxy - fix the --ignore-certs flag for the implicit galaxy server ↵Sloane Hertel2022-01-111-1/+43
| | | | | | | | | | | | | (#76735) * ansible-galaxy - fix the --ignore-certs flag for the implicit galaxy server * changelog * Add a test without the server config * Fix respecting --ignore-certs for individual --server URLs also * Update changelogs/fragments/76735-ansible-galaxy-fix-ignore-certs.yaml
* Fix tests failing on pytest 7 (#76670)Jordan Borean2022-01-081-8/+9
| | | * Fix pytest 7 failures with leaky fixture
* galaxy build - ignore existing MANIFEST and FILES (#76479)Jordan Borean2021-12-071-0/+39
|
* ansible-galaxy role install: download from API response location (#73114)Ross Bender2021-09-221-0/+151
| | | | | | | | | * download role from api response location * include changelog fragment * add unit test for role download url Co-authored-by: Sam Doran <sdoran@redhat.com>
* ansible-galaxy: Clone git collections using shallow clones (#75722)Sloane Hertel2021-09-211-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ansible-galaxy: Clone git collections using shallow clones This ensures the collection obtained via git url is a result of a shallow git clone (git clone --depth=1). The git history of the collection is not used by ansible, and as such, cloning the entire history of the repo is unnecessary. Signed-off-by: Tomas Babej <tomas@tbabej.com> * ansible-galaxy: Only perform shallow clones on non-versioned git urls In general, the version can be anything we can checkout (branch, tag, but also a commit hash). In particular for commit hashes we cannot perform a shallow clone. Err on the safe side and only perform shallow clones for non-versioned git urls (cloning HEAD). * galaxy-install: Make shallow cloning compatible with older Python versions Signed-off-by: Tomas Babej <tomas@tbabej.com> * Pass args as a tuple Add tests for the git command created from different repo and version combinations * changelog Co-authored-by: Tomas Babej <tomas@tbabej.com>
* Enable ansible-galaxy to specify client id override with Keycloak Token (#75601)Chris Hambridge2021-09-171-0/+43
| | | | | | | | | | | | | * 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>
* ansible-galaxy - add a per-server validate_certs option (#75710)Sloane Hertel2021-09-161-1/+44
| | | | | | | * Add a validate_certs option to galaxy server configuration * Add a unit test for cert validation * changelog
* ansible-galaxy - increase page size and add retry decorator for throttling ↵Sloane Hertel2021-05-101-11/+23
| | | | | | | | | | | | | | | | | | (#74240) * Get available collection versions with page_size=100 for v2 and limit=100 for v3 * Update unit tests for larger page sizes * Add a generic retry decorator in module_utils/api.py that accepts an Iterable of delays and a callable to determine if an exception inheriting from Exception should be retried * Use the new decorator to handle Galaxy API rate limiting * Add unit tests for new retry decorator * Preserve the decorated function's metadata with functools.wraps Co-authored-by: Matt Martz <matt@sivel.net> Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* add --offline option to galaxy collection verify (#74040)Matt Davis2021-03-291-1/+1
| | | | | * --offline allows in-place verify for installed collections with manifests * manifest hash, collection name, version, and path are now always displayed * test updates
* ansible-galaxy - set the cache file after getting all collection versions ↵Sloane Hertel2021-02-151-2/+148
| | | | | | | | | (#73557) * Manage the in-memory cache in _call_galaxy but let the caller set the file cache after getting paginated results * Add a test for caching successful and not caching unsuccessful paginated results Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* add option to upgrade collections (#73336)Sloane Hertel2021-02-031-15/+17
| | | | | | * Add a flag to ansible-galaxy to update collections Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>