Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide verbose details about which galaxy server was used #61190

Merged
merged 1 commit into from Aug 22, 2019

Conversation

AlanCoding
Copy link
Member

SUMMARY

This adds debug messages so that people can ascertain the source for the requirements they are using. As far as I can tell, there's no other output telling the user what the correspondence is.

ISSUE TYPE
  • Docs Pull Request
  • Feature Pull Request
COMPONENT NAME

lib/ansible/galaxy/collection.py

ADDITIONAL INFORMATION

I'm building examples for such cases:

https://github.com/AlanCoding/collection-requirements-cases

Here is the output for a case that makes use of @chrismeyersfsu https://galaxy.ansible.com/chrismeyersfsu/test_things, which is not available on https://galaxy-dev.ansible.com. It first tries galaxy-dev, and gets a 404. It then installs from the release galaxy. These debugging statements make that traceable.

ANSIBLE_CONFIG=fallback_not_found/ansible.cfg ansible-galaxy collection install -r fallback_not_found/collections/requirements.yml -p dest -vvvv
ansible-galaxy 2.9.0.dev0
  config file = /Users/alancoding/Documents/repos/collection-requirements-cases/fallback_not_found/ansible.cfg
  configured module search path = ['/Users/alancoding/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alancoding/Documents/repos/ansible/lib/ansible
  executable location = /Users/alancoding/.virtualenvs/ansible3/bin/ansible-galaxy
  python version = 3.6.5 (default, Apr 25 2018, 14:23:58) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
Using /Users/alancoding/Documents/repos/collection-requirements-cases/fallback_not_found/ansible.cfg as config file
Reading requirement file at '/Users/alancoding/Documents/repos/collection-requirements-cases/fallback_not_found/collections/requirements.yml'
 [WARNING]: The specified collections path '/Users/alancoding/Documents/repos/collection-requirements-cases/dest' is not part of the configured Ansible collections paths
'/Users/alancoding/.ansible/collections:/usr/share/ansible/collections'. The installed collection won't be picked up in an Ansible run.

Processing requirement collection 'chrismeyersfsu.test_things'
Collection requirement 'chrismeyersfsu.test_things' is the name of a collection
Opened /Users/alancoding/.ansible/galaxy_token
Collection 'chrismeyersfsu.test_things' is not available from server 'dev_galaxy'
Opened /Users/alancoding/.ansible/galaxy_token
Collection 'chrismeyersfsu.test_things' obtained from server 'release_galaxy'
Processing requirement collection 'chrismeyersfsu.tower_modules'
Collection requirement 'chrismeyersfsu.tower_modules' is the name of a collection
Collection 'chrismeyersfsu.tower_modules' is not available from server 'dev_galaxy'
Collection 'chrismeyersfsu.tower_modules' obtained from server 'release_galaxy'
Installing 'chrismeyersfsu.test_things:2.0.0' to '/Users/alancoding/Documents/repos/collection-requirements-cases/dest/ansible_collections/chrismeyersfsu/test_things'
Downloading https://galaxy.ansible.com/download/chrismeyersfsu-test_things-2.0.0.tar.gz to /Users/alancoding/.ansible/tmp/ansible-local-71101wiwp7slp/tmpufq4ureq
Validating downloaded file hash 77eaccad30c4177c265d023b2f6f042718d24519c7ed1b5ac79772259919d035 with expected hash 77eaccad30c4177c265d023b2f6f042718d24519c7ed1b5ac79772259919d035
Installing 'chrismeyersfsu.tower_modules:0.0.1' to '/Users/alancoding/Documents/repos/collection-requirements-cases/dest/ansible_collections/chrismeyersfsu/tower_modules'
Downloading https://galaxy.ansible.com/download/chrismeyersfsu-tower_modules-0.0.1.tar.gz to /Users/alancoding/.ansible/tmp/ansible-local-71101wiwp7slp/tmpufq4ureq
Validating downloaded file hash 28ee9154a29daa3346ab079b399ffccdce689d0de2598c206deb7b54de32f8fe with expected hash 28ee9154a29daa3346ab079b399ffccdce689d0de2598c206deb7b54de32f8fe

@AlanCoding
Copy link
Member Author

Ping @jborean93

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. needs_triage Needs a first human triage before being processed. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 22, 2019
@@ -320,6 +320,7 @@ def from_name(collection, apis, requirement, force, parent=None):
resp = json.load(open_url(n_collection_url, validate_certs=api.validate_certs, headers=headers))
except urllib_error.HTTPError as err:
if err.code == 404:
display.vvvv("Collection '%s' is not available from server '%s'" % (collection, api.name))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Aug 22, 2019
@jillr jillr removed the needs_triage Needs a first human triage before being processed. label Aug 22, 2019
@@ -320,6 +320,7 @@ def from_name(collection, apis, requirement, force, parent=None):
resp = json.load(open_url(n_collection_url, validate_certs=api.validate_certs, headers=headers))
except urllib_error.HTTPError as err:
if err.code == 404:
display.vvv("Collection '%s' is not available from server '%s'" % (collection, api.name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to also add the URL used to this and the other message you've added below. The name isn't that useful for people who are relying on the defaults and seeing the URL as well helps them to understand what was actually used. An example is https://github.com/ansible/ansible/blob/devel/lib/ansible/galaxy/collection.py#L435

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, formatting (collection , api.name, api.api_server) looks good to me

@AlanCoding
Copy link
Member Author

With latest update, output looks like this:

Processing requirement collection 'chrismeyersfsu.test_things'
Opened /Users/alancoding/.ansible/galaxy_token
Collection 'chrismeyersfsu.test_things' is not available from server dev_galaxy https://galaxy-dev.ansible.com
Opened /Users/alancoding/.ansible/galaxy_token
Collection 'chrismeyersfsu.test_things' obtained from server release_galaxy https://galaxy.ansible.com/
Processing requirement collection 'chrismeyersfsu.tower_modules'
Collection 'chrismeyersfsu.tower_modules' is not available from server dev_galaxy https://galaxy-dev.ansible.com
Collection 'chrismeyersfsu.tower_modules' obtained from server release_galaxy https://galaxy.ansible.com/
Installing 'chrismeyersfsu.test_things:2.0.0' to '/Users/alancoding/Documents/repos/collection-requirements-cases/dest/ansible_collections/chrismeyersfsu/test_things'
Downloading https://galaxy.ansible.com/download/chrismeyersfsu-test_things-2.0.0.tar.gz to /Users/alancoding/.ansible/tmp/ansible-local-7356273w4j093/tmpgba7s86v
Installing 'chrismeyersfsu.tower_modules:0.0.1' to '/Users/alancoding/Documents/repos/collection-requirements-cases/dest/ansible_collections/chrismeyersfsu/tower_modules'
Downloading https://galaxy.ansible.com/download/chrismeyersfsu-tower_modules-0.0.1.tar.gz to /Users/alancoding/.ansible/tmp/ansible-local-7356273w4j093/tmpgba7s86v

I agree, that is a nice aesthetic.

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 22, 2019
@jborean93 jborean93 merged commit e5861eb into ansible:devel Aug 22, 2019
adharshsrivatsr pushed a commit to adharshsrivatsr/ansible that referenced this pull request Sep 3, 2019
@ansible ansible locked and limited conversation to collaborators Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants