Skip to content

orionutils.generator.build_collection fails with surprising error when ansible-galaxy not in PATH #4

@himdel

Description

@himdel

When ansible-galaxy is not installed, or not in PATH, orionutils.generator.build_collection fails with an assert m, stdout AssertionError.

# 👍
$ galaxykit -u admin -p admin collection upload
{"namespace": "admin", "name": "collection_dep_a_robyoszi", "version": "1.0.0", "published": false}

# ❗
$ mv ~/.local/bin/ansible-galaxy{,.bak}

# 👎
$ galaxykit -u admin -p admin collection upload
Traceback (most recent call last):
  File "/home/himdel/.local/bin/galaxykit", line 8, in <module>
    sys.exit(main())
  File "/home/himdel/.local/lib/python3.9/site-packages/galaxykit/command.py", line 254, in main
    artifact = collections.upload_test_collection(
  File "/home/himdel/.local/lib/python3.9/site-packages/galaxykit/collections.py", line 23, in upload_test_collection
    artifact = build_collection(
  File "/home/himdel/.local/lib/python3.9/site-packages/orionutils/generator.py", line 210, in build_collection
    assert m, stdout
AssertionError

Any way to detect and warn about this better? If we can tell running an external command failed, it may be worth it to throw an exception along the lines of "you forgot to pip install ansible".

Or should this package actually depend on ansible?

(Cc @brumik)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions