From f378e25cb2127de467b30dfa20894ffd766a931e Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Mon, 23 Jan 2023 09:01:12 +0100 Subject: [PATCH 1/2] deprecate in favor of vultr.cloud --- plugins/doc_fragments/vultr.py | 5 ++++- plugins/module_utils/vultr.py | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/doc_fragments/vultr.py b/plugins/doc_fragments/vultr.py index cb5cfb6..6386e35 100644 --- a/plugins/doc_fragments/vultr.py +++ b/plugins/doc_fragments/vultr.py @@ -3,6 +3,7 @@ # Copyright (c) 2017 René Moser # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function + __metaclass__ = type @@ -54,5 +55,7 @@ class ModuleDocFragment(object): requirements: - python >= 2.6 notes: - - Also see the API documentation on https://www.vultr.com/api/. + - "DEPRECATED: Please use vultr.cloud instead." + - Also see the API documentation on https://www.vultr.com/api/v1/. + ''' diff --git a/plugins/module_utils/vultr.py b/plugins/module_utils/vultr.py index 81e7b62..74b3908 100644 --- a/plugins/module_utils/vultr.py +++ b/plugins/module_utils/vultr.py @@ -3,17 +3,18 @@ # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) from __future__ import absolute_import, division, print_function + __metaclass__ = type import os -import time import random +import time import urllib + +from ansible.module_utils._text import to_native, to_text from ansible.module_utils.six.moves import configparser -from ansible.module_utils._text import to_text, to_native from ansible.module_utils.urls import fetch_url - VULTR_API_ENDPOINT = "https://api.vultr.com" VULTR_USER_AGENT = 'Ansible Vultr' @@ -40,6 +41,14 @@ def __init__(self, module, namespace): collection_name='ngine_io.vultr', version='2.0.0') # Was Ansbile 2.11 + module.deprecate( + msg="This module is deprecated, it uses the deprecated Vultr v1 API. " + "Please switch to the modules in collection vultr.cloud as soon as possible. " + "Also see https://galaxy.ansible.com/vultr/cloud.", + collection_name="ngine_io.vultr", + version="2.0.0" + ) + self.module = module # Namespace use for returns From c718eb2145939393f4cae96d9d3f154e8e041419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Mon, 23 Jan 2023 22:40:25 +0100 Subject: [PATCH 2/2] add deprecated to docs Co-authored-by: Felix Fontein --- plugins/doc_fragments/vultr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/doc_fragments/vultr.py b/plugins/doc_fragments/vultr.py index 6386e35..e9d911e 100644 --- a/plugins/doc_fragments/vultr.py +++ b/plugins/doc_fragments/vultr.py @@ -55,7 +55,11 @@ class ModuleDocFragment(object): requirements: - python >= 2.6 notes: - - "DEPRECATED: Please use vultr.cloud instead." - Also see the API documentation on https://www.vultr.com/api/v1/. +deprecated: + removed_in: 2.0.0 + why: This module uses the deprecated Vultr v1 API. + alternative: Please use the vultr.cloud collection instead. + '''