Deprecate inventory plugin (#582)

Deprecate inventory plugin

SUMMARY

Deprecate inventory plugin

ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mike Graves <mgraves@redhat.com>
Reviewed-by: Bikouo Aubin
This commit is contained in:
Alina Buzachis
2023-02-16 15:57:38 +01:00
committed by GitHub
parent 031cc7c40d
commit 31c1ccf962
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
deprecated_features:
- k8s - the ``k8s`` inventory plugin has been deprecated and will be removed in release 4.0.0 (https://github.com/ansible-collections/kubernetes.core/issues/31).

View File

@@ -20,6 +20,12 @@ plugin_routing:
inventory:
openshift:
redirect: community.okd.openshift
k8s:
deprecation:
removal_version: 4.0.0
warning_text: >-
The k8s inventory plugin has been deprecated and
will be removed in release 4.0.0.
modules:
k8s_auth:
redirect: community.okd.k8s_auth

View File

@@ -19,6 +19,13 @@ DOCUMENTATION = """
- Uses the kubectl connection plugin to access the Kubernetes cluster.
- Uses k8s.(yml|yaml) YAML configuration file to set parameter values.
deprecated:
removed_in: 4.0.0
why: |
As discussed in U(https://github.com/ansible-collections/kubernetes.core/issues/31), we decided to
remove the k8s inventory plugin in release 4.0.0.
alternative: "Use M(kubernetes.core.k8s_info) and M(ansible.builtin.add_host) instead."
options:
plugin:
description: token that ensures this is a source file for the 'k8s' plugin.
@@ -155,6 +162,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def parse(self, inventory, loader, path, cache=True):
super(InventoryModule, self).parse(inventory, loader, path)
self.display.deprecated(
"The 'k8s' inventory plugin has been deprecated and will be removed in release 4.0.0",
version="4.0.0",
collection_name="kubernetes.core",
)
cache_key = self._get_cache_prefix(path)
config_data = self._read_config_data(path)
self.setup(config_data, cache, cache_key)