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

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

Open
himdel opened this issue Feb 23, 2022 · 0 comments

Comments

@himdel
Copy link

himdel commented Feb 23, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant