summaryrefslogtreecommitdiff
path: root/lib/ansible/galaxy
Commit message (Collapse)AuthorAgeFilesLines
* ansible-galaxy - optimise some paths and use fake galaxy int tests (#67685)Jordan Borean2020-02-292-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | * ansible-galaxy - optimise some paths and use fake galaxy int tests * Added init, built, and publish tests * Test against both mocked Galaxy and AH server * Finish off writing the install tests * Fix up broken tests * Rename test target and add migrated tests * Use cloud provider for Galaxy implementation * Added blank static config * Use correct alias group * Set release version and fix copy typo * Remove reset step as it is no longer needed * Use sane env var names for test container name
* Remove unused variables in collection API (#67724)Abhijeet Kasurde2020-02-251-3/+0
| | | | | Remove unused variables in _download_file API Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Do not error if collection specified null dependencies (#67575)Alan Rominger2020-02-201-6/+10
|
* Specify lowercase only for Galaxy namespaces (#67485)Sandra McCann2020-02-171-1/+1
| | | | | * specify lowercase only for galaxy namespaces * doh... include meta file
* ansible-galaxy - fix role list bug (#67391)Sam Doran2020-02-171-1/+11
| | | | Properly list roles even when the role name is the same or a substring of the path to the role.
* Add ansible-galaxy collection list command (#65022)Sam Doran2020-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start adding ansible-galaxy collection list options * Working list all collections and list a specific collection * Nuke debugging cruft * Use to_text to get a string of the FQCN for sorting * Improve collection output formatting - add header - display collection name and version in separate columns - width of columns is dynamic based on collection name and version length * Make role list output match collection output list - add header - add columns for role name and version - make column width dynamic based on name and version length * remove debug statemnt and extra header * Revert "Make role list output match collection output list" This reverts commit a0b3db47bb3b198aafd34c1f1be5b6561af2f928. * Add validate_collection_path function Utility function for ensuring a collection target ends with 'ansible_collection' * Use validate_collection_path * Do not warn if a specific collection in found in any search path * Fix extraneous warning and remove duplicate code Do not warn when listing a specific collection and it does not exist in other collection paths. Restructure the code that loops through collection paths to remove duplicate conditional code. * Indicate role path was found * Use new function name * WIP Save Point * Use separate functions for role and collection list * Wrap error message There may be a better way to do this besides hard coding a line break, but this does make the message a lot more readable. * Add validate_collection_path function (#66441) * Add validate_collection_path function Utility function for ensuring a collection target ends with 'ansible_collection' * Fix bad syntax * Correct docstring * Bikeshed the names * Properly list a single role * Simplify _display_warnings() Only display warnings. Move exception raise back to each caller. * Move private methods to private functions They don't need self, so it makes sense to have them as functions Get rid of _display_warnings() function since it doesn't do anything worthy of an independent function. * Add integration tests for ansible-galaxy collection list * Fix docs sanity test * Fix bug where ansible_collections dir does not exist The path may exist, but if there is no ansible_collections dir inside that path, an exception was raised in find_existing_collections(). Add integration test for this scenario * Put execute_list() method back * Add some informational messages for debugging * Add unit tests Units tests for the various private methods in support of collection list * Start adding unit tests for test_execute_list * Display collection path when listing specific collection * Add unit tests for listing all collections and specific collection - Create fixture for creating test objects - Add function for controlling os.path.isdir results * Set defaults for minimum collection widths Ensure that collections with small FQCNs display correctly. Add unit tests * Split up unit tests and fix fixtures Add more fixtures for mocking objects during the specific collection tests * Change help message for -p in list subcommand Give accurate description of what it actually does rather than trying to use language shared between sub commands. * Disable colorized output in unit test * Add docs for collection list * Fix integration test on macOS The temp file path is really long on macOS, so the warning message gets wrapped across multiple lines. That make seth grep fail. Switch to matching on a smaller part of the warning. * Recreate common path options for collections Improve help about what the '-p' option does and how it works. * Remove unnecessary elif after continue statements * Account for duplicate paths in collections_searh_paths If someone specifies the same path via '-p' that is the COLLECTIONS_PATHS, do not list the collections twice. * Docs updates
* Add verify subcommand to 'ansible-galaxy collection' (#65618)Sloane Hertel2020-02-141-26/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [WIP] Add verify subcommand command to 'ansible-galaxy collection' * Fix pep8 and use consistent display order * WIP - docs * Remove some redundancy in verify display messages by using an error queue for each collection * Share common code and improve output format * clean up documentation * typo * Apply suggestions from code review Co-Authored-By: Sandra McCann <samccann@redhat.com> * Move ModifiedContent namedtuple to the global scope Add a public metadata property Rename function to _get_json_from_tar_file * Add some unit tests * fix using common functions after rebase * changelog * Improve efficiency finding specific installed collections Improve efficiency by only downloading the tar.gz from the galaxy server for comparison after checking that the collection has been installed Handle multiple collection paths Fix up tests * pep8 * reword that for accuracy * use more common code and verify collection name * Improve error message and add documentation * Update unit tests and add coverage for both local and remote collections that are unable to be located * Only validate collections using the format collection_namespace.collection_name Fix tests to reflect that Fix documentation * Fix a bug when a local collection does not contain a file * pep8 * Fix formatting Co-authored-by: Sandra McCann <samccann@redhat.com>
* galaxy - Fix collection install dep resolver for bad versions (#67405)Jordan Borean2020-02-131-8/+17
| | | | * Also make sure version is a string and not an int/float
* all: fix all the the duplicate words (#66784)Eitan Adler2020-01-281-1/+1
|
* Add validate_collection_path function (#66441)Sam Doran2020-01-221-0/+13
| | | | | | | | | | * Add validate_collection_path function Utility function for ensuring a collection target ends with 'ansible_collection' * Fix bad syntax * Correct docstring
* Rename private function (#66577)Sam Doran2020-01-171-2/+2
| | | Make find_existing_collections() a public function since it is being used across mulitple files now to support listing and verifying collections
* Add a metadata property for CollectionRequirement (#66370)Sloane Hertel2020-01-151-0/+5
| | | | | | * Add a metadata property for CollectionRequirement so the _metadata attribute doesn't need to be accessed directly * changelog
* Don't remove trailing / on galaxy api URLS (#63294)Adrian Likins2020-01-081-2/+2
| | | | | | | | This causes multiple unneeded http redirects. Since each http redirect takes a few hundred milliseconds, handling the redirects starts to take up a significant amount of wall time. Fixes: #63281
* ansible-galaxy - expand User-Agent string for Galaxy endpoints (#65578)Jordan Borean2019-12-066-10/+37
|
* ansible-galaxy - Add User-Agent to requests (#65438)Jordan Borean2019-12-032-2/+4
|
* galaxy - print HTTP reason on unknown error (#65273)Jordan Borean2019-12-031-3/+3
|
* Fix using a URL for galaxy collection install (#65272)Jordan Borean2019-12-031-2/+6
| | | | | | | | * Fix using a URL for galaxy collection install * Update lib/ansible/galaxy/collection.py Co-Authored-By: Sloane Hertel <shertel@redhat.com>
* collection: Provide additional info about collection name restriction (#65250)Abhijeet Kasurde2019-11-261-1/+4
| | | | | Fixes: #65151 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add the ability to ignore files and collection build (#64688)Jordan Borean2019-11-142-16/+31
|
* Fix up role version pagination for Galaxy install (#64373)Jordan Borean2019-11-051-3/+15
| | | | | | * Fix up role version pagination for Galaxy install * Fix sanity issue
* Prevent generating roles that do not pass linting (#63709)Sorin Sbarnea2019-10-222-4/+4
| | | | Fixes bug where newly created role fails linting due to extra space at end of line: [201] Trailing whitespace
* AH servers include automation-hub as part of the server configuration. (#63700)Toshio Kuratomi2019-10-191-1/+1
| | | | | | | | | | * AH servers include automation-hub as part of the server configuration. So we don't need to add it here. Fixes #63699 * Update unittests for the fix to galaxy wait_import_task
* Galaxy publish fix (#63580)Toshio Kuratomi2019-10-162-9/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Handle galaxy v2/v3 API diffs for artifact publish response For publishing a collection artifact (POST /v3/collections/artifacts/), the response format is different between v2 and v3. For v2 galaxy, the 'task' url returned is a full url with scheme: {"task": "https://galaxy-dev.ansible.com/api/v2/collection-imports/35573/"} For v3 galaxy, the task url is relative: {"task": "/api/automation-hub/v3/imports/collections/838d1308-a8f4-402c-95cb-7823f3806cd8/"} So check which API we are using and update the task url approriately. * Use full url for all wait_for_import messages Update unit tests to parameterize the expected responses and urls. * update explanatory comment * Rename n_url to full_url. * Fix issue with overwrite of the complete path * Fixes overwrite of the complete path in case there's extra path stored in self.api_sever * Normalizes the input to the wait_import_task function so it receives the same value on both v2 and v3 Builds on #63523 * Update unittests for new call signature * Add changelog for ansible-galaxy publish API fixes.
* Ensure we preserve the /api appended URL (#63472)Matt Martz2019-10-141-3/+3
|
* Fix galaxy url use everywhere when url is set in config. (#63286)Adrian Likins2019-10-091-0/+4
| | | | | | | | | In addition to trying the configured url (for ex, a migrated 'https://galaxy.ansible.com/') there is an attempt at that URL with '/api' postpended. If the extended URL works, update GalaxyAPI.api_server to use the extended URL. Previously it only used it for finding the API root info ('available_versions', etc)
* Stop appending '/api' to galaxy server url (#63238)Adrian Likins2019-10-081-4/+18
| | | | | | | | | | | | | | | | | | | | * Stop appending '/api' to configured galaxy server url Since not all galaxy REST api server URLs live at '/api', stop always appending it to the 'url' value loaded from config. * Add note about manually migrated galaxy configs and /api * Add '/api/' to galaxy url and guessing if galaxy API * Fix most unit tests (update to expect /api/) * Fix test_initialise_unknown unit test Since we retry now with an added /api/, mock it as well. * Update fallback default avail_ver to new format
* fix typo in collection/plugins/readme (#63162)Sebastian Gumprich2019-10-081-2/+2
|
* Add support for automation-hub authentication to ansible-galaxy (#63031)Adrian Likins2019-10-043-28/+101
| | | Adds support for token authentication in Automation Hub. Fixes: ansible/galaxy-dev#96
* ansible-galaxy - add config to control the display wheel (#61902)Jordan Borean2019-09-131-0/+8
| | | | | | | | * ansible-galaxy - add config to control the display wheel * Fix changelog and make test more stable * Don't use display thread at all if progress wheel isn't being shown
* ansible-galaxy fix --server option for roles (#61820)Jordan Borean2019-09-052-7/+6
|
* Don't truncate the last character from galaxy urls. Fixes #61624 (#61775)Matt Martz2019-09-051-5/+5
|
* Refactor galaxy collection API for v3 support (#61510)Jordan Borean2019-08-302-371/+402
| | | | | | | | | | * Refactor galaxy collection API for v3 support * Added unit tests for GalaxyAPI and starting to fix other failures * finalise tests * more unit test fixes
* Support galaxy v3/autohub API in ansible-galaxy (#60982)Adrian Likins2019-08-282-23/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add galaxy collections API v3 support Issue: ansible/galaxy-dev#60 - Determine if server supports v3 Use 'available_versions' from `GET /api` to determine if 'v3' api is available on the server. - Support v3 pagination style ie, 'limit/offset style', with the paginated responses based on https://jsonapi.org/format/#fetching-pagination v2 galaxy uses pagination that is more or less 'django rest framework style' or 'page/page_size style', based on the default drf pagination described at https://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination - Support galaxy v3 style error response The error objects returned by the galaxy v3 api are based on the JSONAPI response/errors format (https://jsonapi.org/format/#errors). This handles that style response. At least for publish_collection for now. Needs extracting/generalizing. Handle HTTPError in CollectionRequirement.from_name() with _handle_http_error(). It will raise AnsibleError based on the json in an error response. - Update unit tests update test/unit/galaxy/test_collection* to paramaterize calls to test against mocked v2 and v3 servers apis. Update artifacts_versions_json() to tale an api version paramater. Add error_json() for generating v3/v3 style error responses. So now, the urls generated and the pagination schema of the response will use the v3 version if the passed in GalaxyAPI 'galaxy_api' instance has 'v3' in it's available_api_versions * Move checking of server avail versions to collections.py collections.py needs to know the server api versions supported before it makes collection related calls, so the 'lazy' server version check in api.GalaxyAPI is never called and isn't set, so 'v3' servers weren't found. Update unit tests to mock the return value of the request instead of GalaxyAPI itself.
* Provide verbose details about which galaxy server was used (#61190)Alan Rominger2019-08-231-0/+2
|
* ansible-galaxy - Add timeout and progress indicator for publish and install ↵Jordan Borean2019-08-231-35/+114
| | | | | | | | (#60660) * ansible-galaxy - Add timeout and progress indicator for publish * add progress indicator to install phase as well
* add subdir support to collection loading (#60682)Matt Davis2019-08-211-2/+2
| | | | | | | | | | | | | | | * add subdir support to collection loading * collections may now load plugins from subdirs under a plugin type or roles dir, eg `ns.coll.subdir1.subdir2.myrole`->ns.coll's roles/subdir1/subdir2/myrole, `ns.coll.subdir1.mymodule`->ns.coll's plugins/modules/subdir1/mymodule.py * centralize parsing/validation in AnsibleCollectionRef class * fix issues loading Jinja2 plugins from multiple sources * resolves #59462, #59890, * sanity test fixes * string fixes * add changelog entry
* ansible-galaxy - define multiple galaxy instances in ansible.cfg (#60553)Jordan Borean2019-08-215-183/+137
| | | | | | | | | | | | | | | | * ansible-galaxy: support multiple servers on install * Added docs for the server configuration file * Fix up doc string for requirements file format * Fix bugs after testing * Fix kwarg doc and added version * Fix typo and doc improvement * Fix base64 encoding and allow --server to override list
* Made galaxy token file location configurable (#59387)Brian Coca2019-08-142-13/+33
| | | | | | | | | | * Made galaxy token file location configurable also made file handling 'unicode safe' * only create a token on demand * convert into decorator in case other funcs need
* ansible-galaxy tidy up arg parse with better validation (#59957)Jordan Borean2019-08-141-0/+17
| | | | | | | | * ansible-galaxy tidy up arg parse with better validation * Add support back in for -v before sub aprser * Added deprecation warning for manually parsed verbosity
* ansible-galaxy - ignore cert failures for login (#59959)Jordan Borean2019-08-071-6/+10
|
* Remove six decorator for unicode text conversion (#59895)Jordan Borean2019-08-021-16/+18
|
* Ignore collection build release files in the root collection directory (#59121)Jordan Borean2019-07-231-6/+13
|
* Generate galaxy.yml based on single source of truth (#59170)Jordan Borean2019-07-235-76/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | * Generate galaxy.yml based on single source of truth * Fix up tests and align file names * Minor Makefile tweak * Remove link in galaxy.yml file and make it a template file * Moved collections docs to dev_guide * change Makefile clean path * Added readme to example meta file * review fixes * Use newer style for doc generation script * Fix mistake in dev_guide index * removed uneeded file, fixed links and added preview banner * Moved banner for sanity test
* Allow for no role_versions to be present (#56519)Brian Coca2019-07-172-5/+6
| | | | | | | | | | * Allow for no role_versions to be present fixes #46650 better info on fetch, ensure list return * use correct to_
* Remove extra blank line from galaxy .travis.yml.Matt Clay2019-07-161-1/+0
| | | | | | This fixes the last yamllint error on the file. The file is currently ignored by CI, but that will be changing soon.
* ansible-galaxy: add collection sub command (#57106)Jordan Borean2019-07-1018-1/+1054
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ansible-galaxy: add collection init sub command * Fix changelog and other sanity issues * Slim down skeleton structure, fix encoding issue on template * Fix doc generation code to include sub commands * Added build step * Tidy up the build action * Fixed up doc changes and slight testing tweaks * Re-organise tests to use pytest * Added publish step and fixed up issues after working with Galaxy * Unit test improvments * Fix unit test on 3.5 * Add remaining build tests * Test fixes, make the integration tests clearer to debug on failures * Removed unicode name tests until I've got further clarification * Added publish unit tests * Change expected length value * Added collection install steps, tests forthcoming * Added unit tests for collection install entrypoint * Added some more tests for collection install * follow proper encoding rules and added more tests * Add remaining tests * tidied up tests and code based on review * exclude pre-release versions from galaxy API
* Ansible galaxy role download should not have to perform aditionnal check ↵Arnaud RENARD2019-06-131-5/+2
| | | | | against tar archive file extension #56616. (#56617) Ansible galaxy role download checked for `.tar.gz`, but `tarfile.is_tarfile(...)` can identify and open any valid tarfile. This change uses transparent stream compression to make `.tar.gz` and `.tar.bz2` formats valid with python 2.6.x/2.7.x (as well as `.tar.xz` with python 3.x).
* Update galaxy cli metadata file templates (#51398)Andrew Crosby2019-02-224-56/+24
| | | | | | | | | | * Remove github_branch from galaxy meta file templates Signed-off-by: Andrew Crosby <acrosby@redhat.com> * Update galaxy meta license examples to valid SPDX IDs Signed-off-by: Andrew Crosby <acrosby@redhat.com>
* fixing some yamllint issues (#42775)Bas2019-02-2110-12/+6
|
* Consistent typesetting of "GitHub" (#50929)Simon Legner2019-01-151-3/+3
|