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

Give a better error message when using an older/deprecated upcloud-sdk #4

Open
patrick-leb opened this issue Jul 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@patrick-leb
Copy link

patrick-leb commented Jul 13, 2021

Edit: as per below, the problem was the SDK that was on version 1.0.1 when ~2.0 is required. This needs a better error message than crashing with the "unable to parse inventory" error.

======

I installed the collection with galaxy as instructed

My inventory file is:

plugin: community.upcloud.upcloud
tags:
  - swarm

my ansible.cfg is:

[default]
collections_paths = ~/.ansible/collections:/usr/share/ansible/collections

[inventory]
enable_plugins = community.upcloud.upcloud

Result:

ansible git:(main) ✗ ansible-inventory --list -i inventory/upcloud.yaml
[WARNING]:  * Failed to parse /Users/patrickleblanc/ansible/inventory/upcloud.yaml with ansible_collections.community.upcloud.plugins.inventory.upcloud plugin: 'str' object has no
attribute 'user_agent'
[WARNING]: Unable to parse /Users/patrickleblanc/ansible/inventory/upcloud.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

Any idea what I'm doing wrong?

@ajmyyra
Copy link
Member

ajmyyra commented Jul 13, 2021

Hi there! Thank you for bringing this to our attention.

Which version of UpCloud Python SDK do you have installed? The Ansible collection should work with the newest 2.0.0.

If this ends up being the case, could you please modify the issue title and description to give out better error messages on older SDK versions. This is certainly something to fix if it indeed is the case, but it sure sounds like it

@patrick-leb
Copy link
Author

Hey Antti! thanks for the super quick response.

I was with the legacy 1.0.1, coming from the now deprecated ansible module.

I upgraded the package with pip to 2.0.1 and everything is working now!

@patrick-leb patrick-leb changed the title Unable to parse upcloud.yml as an inventory source Give a better error message when using an older/deprecated upcloud-sdk Jul 13, 2021
@ajmyyra
Copy link
Member

ajmyyra commented Jul 13, 2021

Great to hear! Let's leave this open for now, so we can have better error messages on the subject should anyone else run into similar problems.

@thevilledev thevilledev added the enhancement New feature or request label Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants