ibm_zos_core icon indicating copy to clipboard operation
ibm_zos_core copied to clipboard

[Bug][zos_copy] Temporary files are set up in '/tmp/' with no means to override

Open ketankelkar opened this issue 10 months ago • 1 comments

Is there an existing issue for this?

  • [X] There are no existing issues.

Bug description

TL;DR: zos_copy will always copy temporary files to /tmp/. If a user cannot read and write there, the module fails.

The module builds the temporary path (temp_path) with a call to gettempprefix(), which is built-in to the python tempfile library (python docs) and always returns 'tmp'.

temp_path = "/{0}/{1}".format(gettempprefix(), _create_temp_path_name())

Link to src

Even when the ansible_remote_tmp (doc) variable is set in ansible.cfg, the module logic fails to check that configuration and builds the tempfile(s) under /tmp.

The module should honor the configuration set in the ansible_remote_tmp variable and build all temporary dirs/files at the configured location.

Find a way to set up temp_path so that the value of ansible_remote_tmp is honored instead of effectively hard-coding /tmp/... into temp_path.

Reported in IBM internal SLACK thread C0YPDHTGB/p1713974037809719.

IBM z/OS Ansible core Version

v1.8.0 (default)

IBM Z Open Automation Utilities

v1.2.5 (default)

IBM Enterprise Python

v3.12.x

ansible-version

v2.16.x (default)

z/OS version

v2.5 (default)

Ansible module

zos_copy

Playbook verbosity output.

See SLACK thread (verbosity dump may contain some internal IBM info)

Ansible configuration.

No response

Contents of the inventory

No response

Contents of group_vars or host_vars

No response

ketankelkar avatar Apr 24 '24 20:04 ketankelkar

Review after first development for potential second ticket

richp405 avatar Apr 30 '24 19:04 richp405