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

ansible-galaxy fail if dependencies is none #77560

Closed
1 task done
zhan9san opened this issue Apr 19, 2022 · 1 comment · Fixed by #77561
Closed
1 task done

ansible-galaxy fail if dependencies is none #77560

zhan9san opened this issue Apr 19, 2022 · 1 comment · Fixed by #77561
Labels
affects_2.14 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.

Comments

@zhan9san
Copy link
Contributor

Summary

If dependencies in galaxy.yml is defined but not assigned any value, the installation would fail.

Please note the dependencies.

The installation would fail.

namespace: my_namespace
name: my_collection
version: 1.0.0
readme: README.md
authors:
- your name <example@domain.com>
description: your collection description
license:
- GPL-2.0-or-later
license_file: ''
tags: []
dependencies:
repository: http://example.com/repository
documentation: http://docs.example.com
homepage: http://example.com
issues: http://example.com/issue/tracker
build_ignore: []

It works if dependencies is assigned to {}.

namespace: my_namespace
name: my_collection
version: 1.0.0
readme: README.md
authors:
- your name <example@domain.com>
description: your collection description
license:
- GPL-2.0-or-later
license_file: ''
tags: []
dependencies: {}
repository: http://example.com/repository
documentation: http://docs.example.com
homepage: http://example.com
issues: http://example.com/issue/tracker
build_ignore: []

Issue Type

Bug Report

Component Name

ansible-galaxy

Ansible Version

$ ansible --version
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying
the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become
unstable at any point.
ansible [core 2.14.0.dev0] (devel abdd237de7) last updated 2022/04/19 11:12:55 (GMT +800)
  config file = None
  configured module search path = ['/Users/jackzhang/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jackzhang/src/github/ansible/lib/ansible
  ansible collection location = /Users/jackzhang/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/jackzhang/.pyenv/versions/v-397/bin/ansible
  python version = 3.9.7 (default, Oct 28 2021, 19:01:53) [Clang 12.0.5 (clang-1205.0.22.11)]
  jinja version = 3.1.1
  libyaml = True

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

MacOS

Steps to Reproduce

$ ansible-galaxy collection init my_namespace.my_collection
$ cd my_namespace.my_collection
$ gsed -ri 's/^(dependencies:)(.*)$/\1/' galaxy.yml
$ ansible-galaxy collection install -vvv .

Expected Results

I expect the my_namespace.my_collection with dependencies=None can be installed successfully

Actual Results

ansible-galaxy collection install -vvvv .
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying
the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become
unstable at any point.
ansible-galaxy [core 2.14.0.dev0] (devel abdd237de7) last updated 2022/04/19 11:12:55 (GMT +800)
  config file = None
  configured module search path = ['/Users/jackzhang/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jackzhang/src/github/ansible/lib/ansible
  ansible collection location = /Users/jackzhang/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/jackzhang/.pyenv/versions/v-397/bin/ansible-galaxy
  python version = 3.9.7 (default, Oct 28 2021, 19:01:53) [Clang 12.0.5 (clang-1205.0.22.11)]
  jinja version = 3.1.1
  libyaml = True
No config file found; using defaults
Starting galaxy collection install process
Found installed collection geerlingguy.testing:1.0.0 at '/Users/jackzhang/.ansible/collections/ansible_collections/geerlingguy/testing'
Found installed collection lablabs.wireguard:0.1.1 at '/Users/jackzhang/.ansible/collections/ansible_collections/lablabs/wireguard'
[WARNING]: Collection at '/Users/jackzhang/.ansible/collections/ansible_collections/foo/bar' does not have a MANIFEST.json
file, nor has it galaxy.yml: cannot detect version.
Found installed collection foo.bar:* at '/Users/jackzhang/.ansible/collections/ansible_collections/foo/bar'
Found installed collection robertdebock.development_environment:2.1.1 at '/Users/jackzhang/.ansible/collections/ansible_collections/robertdebock/development_environment'
Found installed collection containers.podman:1.9.3 at '/Users/jackzhang/.ansible/collections/ansible_collections/containers/podman'
Found installed collection community.docker:2.3.0 at '/Users/jackzhang/.ansible/collections/ansible_collections/community/docker'
Found installed collection community.general:4.7.0 at '/Users/jackzhang/.ansible/collections/ansible_collections/community/general'
Found installed collection community.molecule:0.1.0 at '/Users/jackzhang/.ansible/collections/ansible_collections/community/molecule'
Process install dependency map
ERROR! Unexpected Exception, this is probably a bug: 'NoneType' object has no attribute 'items'
the full traceback was:

Traceback (most recent call last):
  File "/Users/jackzhang/src/github/ansible/lib/ansible/cli/__init__.py", line 601, in cli_executor
    exit_code = cli.run()
  File "/Users/jackzhang/src/github/ansible/lib/ansible/cli/galaxy.py", line 646, in run
    return context.CLIARGS['func']()
  File "/Users/jackzhang/src/github/ansible/lib/ansible/cli/galaxy.py", line 102, in method_wrapper
    return wrapped_method(*args, **kwargs)
  File "/Users/jackzhang/src/github/ansible/lib/ansible/cli/galaxy.py", line 1300, in execute_install
    self._execute_install_collection(
  File "/Users/jackzhang/src/github/ansible/lib/ansible/cli/galaxy.py", line 1328, in _execute_install_collection
    install_collections(
  File "/Users/jackzhang/src/github/ansible/lib/ansible/galaxy/collection/__init__.py", line 683, in install_collections
    dependency_map = _resolve_depenency_map(
  File "/Users/jackzhang/src/github/ansible/lib/ansible/galaxy/collection/__init__.py", line 1594, in _resolve_depenency_map
    return collection_dep_resolver.resolve(
  File "/Users/jackzhang/.pyenv/versions/3.9.7/envs/v-397/lib/python3.9/site-packages/resolvelib/resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/jackzhang/.pyenv/versions/3.9.7/envs/v-397/lib/python3.9/site-packages/resolvelib/resolvers.py", line 347, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/Users/jackzhang/.pyenv/versions/3.9.7/envs/v-397/lib/python3.9/site-packages/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/Users/jackzhang/.pyenv/versions/3.9.7/envs/v-397/lib/python3.9/site-packages/resolvelib/resolvers.py", line 198, in _get_criteria_to_update
    for r in self._p.get_dependencies(candidate):
  File "/Users/jackzhang/src/github/ansible/lib/ansible/galaxy/dependency_resolution/providers.py", line 425, in get_dependencies
    for dep_name, dep_req in req_map.items()
AttributeError: 'NoneType' object has no attribute 'items'

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@zhan9san
Copy link
Contributor Author

Related to ansible/molecule#3513

@ansibot ansibot added affects_2.14 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels Apr 19, 2022
@ansibot ansibot added the has_pr This issue has an associated PR. label Apr 19, 2022
@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Apr 19, 2022
@ansible ansible locked and limited conversation to collaborators Apr 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.14 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants