Skip to content

Commit acd878d

Browse files
Release tasks v1.14.0 GA (#2189)
* [v1.14.0] Avoid failures when default dir ~/.ansible/tmp/ is not previously created and fix failures when using become in zos_job_submit (#2109) * Updated plugins in zos_copy * Updated action zos_job_submit * Updated tests * Updated permissions * Added fix for content * Added changelogs * Updated zos_job_submit action plugin * Fixed sanity issue * Updated zos_copy * Started release process * Updated lifecylce * Updated meta * Updated zos_mount docs * Updated docs * Updated data set utils * Updated release notes * Updaded lifecycle
1 parent a2c1f48 commit acd878d

File tree

12 files changed

+148
-47
lines changed

12 files changed

+148
-47
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ ibm.ibm\_zos\_core Release Notes
44

55
.. contents:: Topics
66

7-
v1.14.0-beta.1
8-
==============
7+
v1.14.0
8+
=======
99

1010
Release Summary
1111
---------------
1212

13-
Release Date: '2025-04-30'
13+
Release Date: '2025-06-30'
1414
This changelog describes all changes made to the modules and plugins included
1515
in this collection. The release date is the date the changelog is created.
1616
For additional details such as required dependencies and availability review
@@ -43,12 +43,14 @@ Bugfixes
4343

4444
- zos_apf - When trying to add a library into the APF list that was already added, the module would fail. Fix now will not fail the module, and will inform the user that the library is already on the APF list. (https://github.com/ansible-collections/ibm_zos_core/pull/1893)
4545
- zos_copy - Previously, if the dataset name included special characters such as $, validation would fail when force_lock was false. This has been changed to allow the use of special characters when force_lock option is false. (https://github.com/ansible-collections/ibm_zos_core/pull/1908)
46+
- zos_copy - Previously, when trying to copy into remote and ansible's default temporary directory was not created before execution the copy task would fail. Fix now creates the temporary directory if possible. (https://github.com/ansible-collections/ibm_zos_core/pull/2109)
4647
- zos_copy - When ``asa_text`` was set to true at the same time as ``force_lock``, a copy would fail saying the destination was already in use. Fix now opens destination data sets up with disposition SHR when ``force_lock`` and ``asa_text`` are set to true. (https://github.com/ansible-collections/ibm_zos_core/pull/1941).
4748
- zos_copy - the carriage return characters were being removed from only first 1024 bytes of a file. Now fixed that issue to support removal of the carriage return characters from the complete file content if the file size is more than 1024 bytes. (https://github.com/ansible-collections/ibm_zos_core/pull/1954).
4849
- zos_data_set - Module would fail when trying to delete a non-existent Generation Data Group. Fix now provides a successful response with `changed=false`. (https://github.com/ansible-collections/ibm_zos_core/pull/1971).
4950
- zos_data_set - Module would fail with TypeError when trying to replace an existing GDG. Fix now allows to replacing a GDG. (https://github.com/ansible-collections/ibm_zos_core/pull/1964).
5051
- zos_job_output - When searching for a job name, module performed a '*' (find all), then filtered the results. Fix now asks for specific job name, making the return faster and more precise. (https://github.com/ansible-collections/ibm_zos_core/pull/1916).
5152
- zos_job_query - When searching for a job name, module performed a '*' (find all), then filtered the results. Fix now asks for specific job name, making the return faster and more precise. (https://github.com/ansible-collections/ibm_zos_core/pull/1916).
53+
- zos_job_submit - Previously, the use of `become` would result in a permissions error while trying to execute a job from a local file. Fix now allows a user to escalate privileges when executing a job transferred from the controller node. (https://github.com/ansible-collections/ibm_zos_core/pull/2109)
5254
- zos_job_submit - When searching for a job name, module performed a '*' (find all), then filtered the results. Fix now asks for specific job name, making the return faster and more precise. (https://github.com/ansible-collections/ibm_zos_core/pull/1916).
5355
- zos_mount - Module failed when using persistent option with a data set that contains non UTF-8 characters. Fix now can use a data set with non UTF-8 characters as data_store. (https://github.com/ansible-collections/ibm_zos_core/pull/1871).
5456

changelogs/changelog.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,29 @@ releases:
679679
name: zos_zfs_resize
680680
namespace: ''
681681
release_date: '2025-01-30'
682+
1.14.0:
683+
changes:
684+
bugfixes:
685+
- zos_copy - Previously, when trying to copy into remote and ansible's default
686+
temporary directory was not created before execution the copy task would fail.
687+
Fix now creates the temporary directory if possible. (https://github.com/ansible-collections/ibm_zos_core/pull/2109)
688+
- zos_job_submit - Previously, the use of `become` would result in a permissions
689+
error while trying to execute a job from a local file. Fix now allows a user
690+
to escalate privileges when executing a job transferred from the controller
691+
node. (https://github.com/ansible-collections/ibm_zos_core/pull/2109)
692+
release_summary: 'Release Date: ''2025-06-30''
693+
694+
This changelog describes all changes made to the modules and plugins included
695+
696+
in this collection. The release date is the date the changelog is created.
697+
698+
For additional details such as required dependencies and availability review
699+
700+
the collections `release notes <https://ibm.github.io/z_ansible_collections_doc/ibm_zos_core/docs/source/release_notes.html>`__'
701+
fragments:
702+
- 2109-copy-fix-tmp-dir.yml
703+
- v1.14.0_summary.yml
704+
release_date: '2025-06-24'
682705
1.14.0-beta.1:
683706
changes:
684707
bugfixes:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bugfixes:
2+
- zos_job_submit - Previously, the use of `become` would result in a permissions error
3+
while trying to execute a job from a local file. Fix now allows a user to escalate
4+
privileges when executing a job transferred from the controller node.
5+
(https://github.com/ansible-collections/ibm_zos_core/pull/2109)
6+
- zos_copy - Previously, when trying to copy into remote and ansible's default temporary directory
7+
was not created before execution the copy task would fail. Fix now creates the temporary directory if possible.
8+
(https://github.com/ansible-collections/ibm_zos_core/pull/2109)

docs/source/life-cycle.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ its critical dates, and which type of support it's currently eligible for.
2727
+------------+----------------+-----------------------+------------------+-------------------+-------------------------+
2828
| Version | Status | Changelogs | GA Date | EOL Date | Life Cycle Phase |
2929
+============+================+=======================+==================+===================+=========================+
30-
| 1.14.x | In preview | `1.14.x changelogs`_ | TBD | TBD | Beta phase |
30+
| 1.14.x | Released | `1.14.x changelogs`_ | 30 June 2025 | 30 June 2027 | `Full support`_ |
3131
+------------+----------------+-----------------------+------------------+-------------------+-------------------------+
32-
| 1.13.x | Released | `1.13.x changelogs`_ | 31 March 2025 | 31 March 2026 | `Full support`_ |
32+
| 1.13.x | Released | `1.13.x changelogs`_ | 31 March 2025 | 31 March 2027 | `Full support`_ |
3333
+------------+----------------+-----------------------+------------------+-------------------+-------------------------+
3434
| 1.12.x | Released | `1.12.x changelogs`_ | 06 December 2024 | 06 December 2026 | `Full support`_ |
3535
+------------+----------------+-----------------------+------------------+-------------------+-------------------------+
@@ -41,6 +41,8 @@ its critical dates, and which type of support it's currently eligible for.
4141
.. .............................................................................
4242
.. Global Links
4343
.. .............................................................................
44+
.. _1.14.x changelogs:
45+
https://github.com/ansible-collections/ibm_zos_core/blob/v1.14.0/CHANGELOG.rst
4446
.. _1.13.x changelogs:
4547
https://github.com/ansible-collections/ibm_zos_core/blob/v1.13.0/CHANGELOG.rst
4648
.. _1.12.x changelogs:

docs/source/modules/zos_mount.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,16 @@ Examples
316316
path: /u/omvsadm/core
317317
fs_type: zfs
318318
state: unmounted
319-
unmount_opts: REMOUNT
320-
opts: same
319+
unmount_opts: remount
320+
mount_opts: same
321321

322322
- name: Mount a filesystem readonly.
323323
zos_mount:
324324
src: SOMEUSER.VVV.ZFS
325325
path: /u/omvsadm/core
326326
fs_type: zfs
327327
state: mounted
328-
mount_opts: RO
328+
mount_opts: ro
329329

330330
- name: Mount a filesystem and record change in BPXPRMAA.
331331
zos_mount:
@@ -363,23 +363,23 @@ Examples
363363
path: /u/omvsadm/core
364364
fs_type: zfs
365365
state: mounted
366-
opts: nowait
366+
mount_opts: nowait
367367

368368
- name: Mount a filesystem with no security checks.
369369
zos_mount:
370370
src: SOMEUSER.VVV.ZFS
371371
path: /u/omvsadm/core
372372
fs_type: zfs
373373
state: mounted
374-
mount_opts: NOSECURITY
374+
mount_opts: nosecurity
375375

376376
- name: Mount a filesystem, limiting automove to 4 devices.
377377
zos_mount:
378378
src: SOMEUSER.VVV.ZFS
379379
path: /u/omvsadm/core
380380
fs_type: zfs
381381
state: mounted
382-
automove: AUTOMOVE
382+
automove: automove
383383
automove_list: I,DEV1,DEV2,DEV3,DEV9
384384

385385
- name: Mount a filesystem, limiting automove to all except 4 devices.
@@ -388,7 +388,7 @@ Examples
388388
path: /u/omvsadm/core
389389
fs_type: zfs
390390
state: mounted
391-
automove: AUTOMOVE
391+
automove: automove
392392
automove_list: EXCLUDE,DEV4,DEV5,DEV6,DEV7
393393

394394

@@ -500,14 +500,14 @@ unmount_opts
500500

501501
| **returned**: changed and if state=unmounted
502502
| **type**: str
503-
| **sample**: DRAIN
503+
| **sample**: drain
504504
505505
mount_opts
506506
Options available to the mount.
507507

508508
| **returned**: whenever non-None
509509
| **type**: str
510-
| **sample**: RW,NOSECURITY
510+
| **sample**: rw,nosecurity
511511
512512
src_params
513513
Specifies a parameter string to be passed to the file system type.
@@ -554,7 +554,7 @@ automove
554554

555555
| **returned**: if Non-None
556556
| **type**: str
557-
| **sample**: AUTOMOVE
557+
| **sample**: automove
558558
559559
automove_list
560560
This specifies the list of servers to include or exclude as destinations.

docs/source/release_notes.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
Releases
77
========
88

9-
Version 1.14.0-beta.1
10-
=====================
9+
Version 1.14.0
10+
==============
1111

1212
Minor Changes
1313
-------------
@@ -18,6 +18,7 @@ Minor Changes
1818
- Adds logging of Jinja rendered template content when `use_template` is true and verbosity level `-vvv` is used.
1919
- Adds support for copying in asynchronous mode inside playbooks.
2020
- Removes the need to allow READ access to MVS.MCSOPER.ZOAU to execute the module by changing how the module checks if a data set is locked.
21+
- Previously, when trying to copy into remote and ansible's default temporary directory was not created before execution the copy task would fail. Fix now creates the temporary directory if possible.
2122

2223
- ``zos_job_output`` - Add execution_time return value in the modules response.
2324
- ``zos_job_query``
@@ -31,6 +32,7 @@ Minor Changes
3132
- Adds logging of Jinja rendered template content when `use_template` is true and verbosity level `-vvv` is used.
3233
- Add execution_time return value in the modules response.
3334
- Loads correct bytes size value for dds when using zoau 1.3.4 or later.
35+
- Previously, the use of `become` would result in a permissions error while trying to execute a job from a local file. Fix now allows a user to escalate privileges when executing a job transferred from the controller node.
3436

3537
- ``zos_script``
3638

@@ -70,12 +72,18 @@ New Modules
7072
Availability
7173
------------
7274

75+
* `Ansible Automation Platform`_
7376
* `Galaxy`_
7477
* `GitHub`_
7578

7679
Known Issues
7780
------------
7881
- ``zos_copy`` - Copying from a sequential data set that is in use will result in a false positive and destination data set will be empty. The same is true when ``type=gdg`` and source GDS is a sequential data set in use.
82+
- ``zos_copy`` - When elevating privileges using the `become` keyword, the module would attempt to connect using the elevated user id, if the user cannot connect to the managed node through ssh the module would fail.
83+
- ``zos_job_submit`` - When elevating privileges using the `become` keyword, the module would attempt to connect using the elevated user id, if the user cannot connect to the managed node through ssh the module would fail.
84+
- ``zos_script`` - When elevating privileges using the `become` keyword, the module would attempt to connect using the elevated user id, if the user cannot connect to the managed node through ssh the module would fail.
85+
- ``zos_unarchive`` - When elevating privileges using the `become` keyword, the module would attempt to connect using the elevated user id, if the user cannot connect to the managed node through ssh the module would fail.
86+
- ``zos_fetch`` - When elevating privileges using the `become` keyword, the module would attempt to connect using the elevated user id, if the user cannot connect to the managed node through ssh the module would fail.
7987

8088

8189

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace: ibm
66
name: ibm_zos_core
77

88
# The collection version
9-
version: "1.14.0-beta.1"
9+
version: "1.14.0"
1010

1111
# Collection README file
1212
readme: README.md

meta/ibm_zos_core_meta.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: ibm_zos_core
2-
version: "1.14.0-beta.1"
2+
version: "1.14.0"
33
managed_requirements:
44
-
55
name: "IBM Open Enterprise SDK for Python"
6-
version: ">=3.11"
6+
version: ">=3.12"
77
-
88
name: "Z Open Automation Utilities"
99
version:

plugins/action/zos_copy.py

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def run(self, tmp=None, task_vars=None):
155155
try:
156156
local_content = _write_content_to_temp_file(content)
157157
transfer_res = self._copy_to_remote(
158-
local_content, ignore_stderr=ignore_sftp_stderr
158+
local_content, ignore_stderr=ignore_sftp_stderr, task_vars=task_vars
159159
)
160160
finally:
161161
os.remove(local_content)
@@ -243,7 +243,7 @@ def run(self, tmp=None, task_vars=None):
243243

244244
display.vvv(u"ibm_zos_copy calculated size: {0}".format(os.stat(src).st_size), host=self._play_context.remote_addr)
245245
transfer_res = self._copy_to_remote(
246-
src, is_dir=is_src_dir, ignore_stderr=ignore_sftp_stderr
246+
src, is_dir=is_src_dir, ignore_stderr=ignore_sftp_stderr, task_vars=task_vars
247247
)
248248

249249
temp_path = transfer_res.get("temp_path")
@@ -291,7 +291,26 @@ def run(self, tmp=None, task_vars=None):
291291
# Remove temporary directory from remote
292292
if self.tmp_dir is not None:
293293
path = os.path.normpath(f"{self.tmp_dir}/ansible-zos-copy")
294-
self._connection.exec_command(f"rm -rf {path}*")
294+
# If another user created the temporary files, we'll need to run rm
295+
# with it too, lest we get a permissions issue.
296+
if self._connection.become:
297+
# We get the dirname from temp_path and not path = os.path.normpath(f"{self.tmp_dir}/ansible-zos-copy")
298+
# because if default is ~/.ansible/tmp/ when using become it would be similar to /root/.ansible/tmp
299+
# but the original tmp directory was resolved when user is non escalated yet. Meaning, the original
300+
# tmp directory is similar to /u/usrt001/.ansible/tmp.
301+
path = os.path.dirname(temp_path)
302+
self._connection.set_option('remote_user', self._play_context._become_user)
303+
display.vvv(
304+
u"ibm_zos_copy SSH cleanup user updated to {0}".format(self._play_context._become_user),
305+
host=self._play_context.remote_addr
306+
)
307+
rm_res = self._connection.exec_command(f"rm -rf {path}*")
308+
if self._connection.become:
309+
self._connection.set_option('remote_user', self._play_context._remote_user)
310+
display.vvv(
311+
u"ibm_zos_copy SSH cleanup user restored to {0}".format(self._play_context._remote_user),
312+
host=self._play_context.remote_addr
313+
)
295314

296315
if copy_res.get("note") and not force:
297316
result["note"] = copy_res.get("note")
@@ -319,18 +338,21 @@ def run(self, tmp=None, task_vars=None):
319338

320339
return copy_res
321340

322-
def _copy_to_remote(self, src, is_dir=False, ignore_stderr=False):
341+
def _copy_to_remote(self, src, is_dir=False, ignore_stderr=False, task_vars=None):
323342
"""Copy a file or directory to the remote z/OS system """
324343
self.tmp_dir = self._connection._shell._options.get("remote_tmp")
325-
rc, stdout, stderr = self._connection.exec_command("cd {0} && pwd".format(self.tmp_dir))
326-
if rc > 0:
327-
msg = f"Failed to resolve remote temporary directory {self.tmp_dir}. Ensure that the directory exists and user has proper access."
328-
return self._exit_action({}, msg, failed=True)
329-
self.tmp_dir = stdout.decode("utf-8").replace("\r", "").replace("\n", "")
330-
temp_path = os.path.join(self.tmp_dir, _create_temp_path_name(), os.path.basename(src))
331-
self._connection.exec_command("mkdir -p {0}".format(os.path.dirname(temp_path)))
332-
_src = src.replace("#", "\\#")
344+
temp_path = os.path.join(self.tmp_dir, _create_temp_path_name())
345+
tempfile_args = {"path": temp_path, "state": "directory", "mode": "666"}
346+
# Reverted this back to using file ansible module so ansible would handle all temporary dirs
347+
# creation with correct permissions.
348+
tempfile = self._execute_module(
349+
module_name="file", module_args=tempfile_args, task_vars=task_vars, wrap_async=self._task.async_val
350+
)
333351
_sftp_action = 'put'
352+
was_user_updated = False
353+
354+
temp_path = os.path.join(tempfile.get("path"), os.path.basename(src))
355+
_src = src.replace("#", "\\#")
334356
full_temp_path = temp_path
335357

336358
if is_dir:
@@ -370,6 +392,13 @@ def _copy_to_remote(self, src, is_dir=False, ignore_stderr=False):
370392
sftp_transfer_method), host=self._play_context.remote_addr)
371393

372394
display.vvv(u"ibm_zos_copy: {0} {1} TO {2}".format(_sftp_action, _src, temp_path), host=self._play_context.remote_addr)
395+
if self._connection.become:
396+
was_user_updated = True
397+
self._connection.set_option('remote_user', self._play_context._become_user)
398+
display.vvv(
399+
u"ibm_zos_copy SSH transfer user updated to {0}".format(self._play_context._become_user),
400+
host=self._play_context.remote_addr
401+
)
373402
(returncode, stdout, stderr) = self._connection._file_transport_command(_src, temp_path, _sftp_action)
374403

375404
display.vvv(u"ibm_zos_copy return code: {0}".format(returncode), host=self._play_context.remote_addr)
@@ -400,7 +429,7 @@ def _copy_to_remote(self, src, is_dir=False, ignore_stderr=False):
400429

401430
if returncode != 0 or (err and not ignore_stderr):
402431
return dict(
403-
msg="Error transfering source '{0}' to remote z/OS system".format(src),
432+
msg="Error transferring source '{0}' to remote z/OS system".format(src),
404433
rc=returncode,
405434
stderr=err,
406435
stderr_lines=err.splitlines(),
@@ -409,6 +438,12 @@ def _copy_to_remote(self, src, is_dir=False, ignore_stderr=False):
409438

410439
finally:
411440
# Restore the users defined option `ssh_transfer_method` if it was overridden
441+
if was_user_updated:
442+
self._connection.set_option('remote_user', self._play_context._remote_user)
443+
display.vvv(
444+
u"ibm_zos_copy SSH transfer user restored to {0}".format(self._play_context._remote_user),
445+
host=self._play_context.remote_addr
446+
)
412447

413448
if is_ssh_transfer_method_updated:
414449
if version_major == 2 and version_minor >= 11:

0 commit comments

Comments
 (0)