diff --git a/changelogs/fragments/422-k8s_cp-fix-issue-when-issue-local_path.yaml b/changelogs/fragments/422-k8s_cp-fix-issue-when-issue-local_path.yaml new file mode 100644 index 00000000..5677ff8c --- /dev/null +++ b/changelogs/fragments/422-k8s_cp-fix-issue-when-issue-local_path.yaml @@ -0,0 +1,2 @@ +bugfixes: + - k8s_cp - fix issue when using parameter local_path with file on managed node. (https://github.com/ansible-collections/kubernetes.core/issues/421). diff --git a/plugins/action/k8s_info.py b/plugins/action/k8s_info.py index 674ebcb9..cfcbb28d 100644 --- a/plugins/action/k8s_info.py +++ b/plugins/action/k8s_info.py @@ -380,7 +380,7 @@ class ActionModule(ActionBase): local_path = self._task.args.get("local_path") state = self._task.args.get("state", None) - if local_path and state == "to_pod": + if local_path and state == "to_pod" and not remote_transport: new_module_args["local_path"] = self.get_file_realpath(local_path) # Execute the k8s_* module.