From 2c394132aab6f7c0b136d91ef3743a249cbfc003 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Tue, 28 May 2024 15:44:03 +0200 Subject: [PATCH] connection/oc - add option oc_local_env_vars (#225) * add local env vars for connection/oc plugin * Fix sanity tests --- ...0523-connection-oc-add-support-for-local-env-vars.yml | 3 +++ ci/downstream_fragments.py | 6 ++++++ plugins/connection/oc.py | 9 +++++++++ 3 files changed, 18 insertions(+) create mode 100644 changelogs/fragments/20240523-connection-oc-add-support-for-local-env-vars.yml diff --git a/changelogs/fragments/20240523-connection-oc-add-support-for-local-env-vars.yml b/changelogs/fragments/20240523-connection-oc-add-support-for-local-env-vars.yml new file mode 100644 index 0000000..f415684 --- /dev/null +++ b/changelogs/fragments/20240523-connection-oc-add-support-for-local-env-vars.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - connection/oc - added support of local enviroment variable that will be used for ``oc`` and may be requried for establishing connections ifself (https://github.com/openshift/community.okd/pull/225). diff --git a/ci/downstream_fragments.py b/ci/downstream_fragments.py index 727be61..32a7dbd 100755 --- a/ci/downstream_fragments.py +++ b/ci/downstream_fragments.py @@ -11,6 +11,12 @@ with open("./rendereddocfragments.txt", 'w') as df_fd: with open(sys.argv[2], 'r') as fd: json_docs = json.load(fd) + # ansible-doc has introduced a 'doc.plugin_name' on branch 'stable-2.17' + # This change generated the following sanity tests error. + # invalid-documentation: DOCUMENTATION.plugin_name: extra keys not allowed @ data['plugin_name']. + # This will be removed from the module documentation + + json_docs[sys.argv[1]]['doc'].pop('plugin_name', '') json_docs[sys.argv[1]]['doc'].pop('collection', '') json_docs[sys.argv[1]]['doc'].pop('filename', '') json_docs[sys.argv[1]]['doc'].pop('has_action', '') diff --git a/plugins/connection/oc.py b/plugins/connection/oc.py index ae399e6..23e2e6e 100644 --- a/plugins/connection/oc.py +++ b/plugins/connection/oc.py @@ -106,6 +106,15 @@ DOCUMENTATION = """ env: - name: K8S_AUTH_TOKEN - name: K8S_AUTH_API_KEY + oc_local_env_vars: + description: + - Local environment variable to be passed locally to the oc command line. + - Please be aware that this passes information directly on the command line and it could expose sensitive data. + default: {} + type: dict + version_added: 4.0.0 + vars: + - name: ansible_oc_local_env_vars client_cert: description: - Path to a certificate used to authenticate with the API.