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

feat: add support for vultr api v2 #14587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dhruvkelawala
Copy link

@dhruvkelawala dhruvkelawala commented Mar 4, 2023

Description

Added support for Vultr Api v2 as new accounts on Vultr won't be able to use v1 api. Old accounts will be unable to use v1 api after June 2023.

Motivation and Context

This change makes sure AlgoVPN can be use by new and old users of Vultr

Fixes #14580

How Has This Been Tested?

Tested by Creating a VPS on Vultr with Ubuntu on my macbook m1

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@CLAassistant
Copy link

CLAassistant commented Mar 4, 2023

CLA assistant check
All committers have signed the CLA.

@cooper667
Copy link

👍 Worked well for me, thanks

@dhruvkelawala
Copy link
Author

Waiting for it to be merged. Not sure if it will ever be 😂

Copy link

@mkurapov mkurapov left a comment

Choose a reason for hiding this comment

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

This worked for me, thank you!

@@ -12,17 +12,21 @@
set_fact:
algo_vultr_config: "{{ vultr_config | default(_vultr_config.user_input) | default(lookup('env','VULTR_API_CONFIG'), true) }}"

- name: Set the Vultr API Key as a fact
set_fact:
vultr_api_key: "{{ lookup('ansible.builtin.ini', 'key', section='default', file=algo_vultr_config) }}"

Choose a reason for hiding this comment

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

When I reached the "Enter the local path to your configuration INI file" prompt, I left it blank in hopes it would use ~/.vultr.ini by default, but I got an error:

"msg": "An unhandled exception occurred while running the lookup plugin 'ansible.builtin.ini'. Error was a <class 'ansible.errors.AnsibleParserError'>, original message: an error occurred while trying to read the file '/Users/max/dev/algo/roles/cloud-vultr/': [Errno 21] Is a directory:

I'm guessing it didn't like the empty input?

However, after entering ~/.vultr.ini directly, everything worked for me

@dhruvkelawala
Copy link
Author

Thanks for the review! Please feel free to merge 🙂

@dhruvkelawala
Copy link
Author

@pentest01 @mkurapov Any plans to merge this and make a release?

@amitai
Copy link

amitai commented Nov 18, 2023

Hi, would love to see this released.

@amitai
Copy link

amitai commented Nov 28, 2023

I tried with this fork and still got the API error:

TASK [cloud-vultr : Creating a firewall group] *********************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Reached API retries limit 5 for URL https://api.vultr.com/v1/firewall/group_list, method GET with data None. Returned 503, with body: HTTP Error 503: API v1 Gone b'Sorry, all newly created accounts are forbidden from using API v1, all other accounts are able to use this deprecated API until September 30, 2023 at which point Vultr API v1 will be sunset. Please use API v2.'", "vultr_api": {"api_account": "default", "api_endpoint": "https://api.vultr.com", "api_retries": 5, "api_retry_max_delay": 12, "api_timeout": 60}, "vultr_firewall_group": {}}

@jackivanov
Copy link
Collaborator

Sorry for my delay. Feel free to rebase and I'll review

@dhruvkelawala
Copy link
Author

Will do it

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

Successfully merging this pull request may close these issues.

Vultr V2 API
7 participants