diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 383227437f..431d82386d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ You can install ``collection_prep`` using After installation, you can update documentation - # collection_prep_add_docs -p //kubernetes.core + # collection_prep_add_docs -p //kubernetes/core Review the changes and create a pull request using updated files. diff --git a/changelogs/fragments/20240426-add-support-of-kubectl-local-env-vars-for-connection-plugin.yml b/changelogs/fragments/20240426-add-support-of-kubectl-local-env-vars-for-connection-plugin.yml index db2df29f49..226ad58271 100644 --- a/changelogs/fragments/20240426-add-support-of-kubectl-local-env-vars-for-connection-plugin.yml +++ b/changelogs/fragments/20240426-add-support-of-kubectl-local-env-vars-for-connection-plugin.yml @@ -1,3 +1,3 @@ --- minor_changes: - - kubectl - added support of local enviroment variable that will be used for kubectl and may be requried for establishing connections ifself (https://github.com/ansible-collections/kubernetes.core/pull/702) \ No newline at end of file + - kubectl - added support of local enviroment variable that will be used for kubectl and may be requried for establishing connections ifself (https://github.com/ansible-collections/kubernetes.core/pull/702) diff --git a/plugins/connection/kubectl.py b/plugins/connection/kubectl.py index 77113e21ad..2a5e1b988f 100644 --- a/plugins/connection/kubectl.py +++ b/plugins/connection/kubectl.py @@ -318,11 +318,10 @@ def _local_env(self): if local_env_vars: if isinstance(local_env_vars, dict): local_env_vars = json.dumps(local_env_vars) - local_env = dict(os.environ) + local_env = os.environ.copy() local_env.update(json.loads(local_env_vars)) return local_env - else: - return None + return None def _connect(self, port=None): """Connect to the container. Nothing to do"""