Skip to content

Commit c1d42bf

Browse files
AndreMarcel99André Marcel Gutiérrez Benítez
andauthored
[Enabler][2208]Adopt_generation_data_group_generations (#2365)
* Fix new order and adopt of gdgs.generations for 1.4 * Add fixes for -1 values * return to old call of list * Fix to new logic that go to the creation that shows * Add comment * Add fragment and fail on other test * Modify error message catch * Add zos_stat changes * Delete argument for create gdg * Fix mvs_raw error for uncatalog * Comment fail test case * Fix testing stdout message * Uncoment gdg test cases zos_copy and zos_replace * Restore test * Fix new creation * Update fragment for mvs raw * Fix typo * Update 2365-Adopt_generation_data_group_generations.yml * Update data_set.py * Fix creation of gdg to datasets.create * Update false negative --------- Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]>
1 parent 5c022ec commit c1d42bf

File tree

11 files changed

+698
-686
lines changed

11 files changed

+698
-686
lines changed

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"exclude": {
3-
"files": "zos_mvs_raw.rst|^.secrets.baseline$",
3+
"files": "zos_mvs_raw.rst|test_zos_apf_func.py|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-09-01T16:59:39Z",
6+
"generated_at": "2025-10-23T20:47:32Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -77,7 +77,7 @@
7777
}
7878
],
7979
"results": {},
80-
"version": "0.13.1+ibm.62.dss",
80+
"version": "0.13.1+ibm.64.dss",
8181
"word_list": {
8282
"file": null,
8383
"hash": null
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trivial:
2+
- module_utils/data_set - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
3+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)
4+
- module_utils/copy - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
5+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)
6+
- modules/zos_copy - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
7+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)
8+
- modules/zos_fetch - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
9+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)
10+
- modules/zos_mvs_raw - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
11+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)
12+
- modules/zos_stat - Adopt new GenerationDataGroupView generations property for ZOAU 1.4.0.
13+
(https://github.com/ansible-collections/ibm_zos_core/pull/2365)

plugins/module_utils/copy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def copy_gdg2uss(src, dest, binary=False, asa_text=False):
149149
True if all copies were successful, False otherwise.
150150
"""
151151
src_view = gdgs.GenerationDataGroupView(src)
152-
generations = src_view.generations()
152+
generations = src_view.generations
153153

154154
copy_args = {
155155
"options": ""

plugins/module_utils/data_set.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,8 +1859,9 @@ def resolve_gds_absolute_name(relative_name):
18591859
# Fail if we are trying to resolve a future generation.
18601860
raise Exception
18611861
gdg = gdgs.GenerationDataGroupView(name=gdg_base)
1862-
generations = gdg.generations()
1863-
gds = generations[rel_generation - 1]
1862+
generations = gdg.generations
1863+
# From ZOAU 1.4 version relative notation 0 or -1 is on automatic give
1864+
gds = generations[rel_generation]
18641865
except Exception:
18651866
raise GDSNameResolveError(relative_name)
18661867

plugins/modules/zos_copy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ def copy_to_gdg(self, src, dest):
11871187
True if every copy operation was successful, False otherwise.
11881188
"""
11891189
src_view = gdgs.GenerationDataGroupView(src)
1190-
generations = src_view.generations()
1190+
generations = src_view.generations
11911191
copy_args = {
11921192
"options": ""
11931193
}
@@ -2756,8 +2756,8 @@ def does_destination_allow_copy(
27562756
src_view = gdgs.GenerationDataGroupView(src)
27572757
dest_view = gdgs.GenerationDataGroupView(dest)
27582758

2759-
src_allocated_gens = len(src_view.generations())
2760-
dest_allocated_gens = len(dest_view.generations())
2759+
src_allocated_gens = len(src_view.generations)
2760+
dest_allocated_gens = len(dest_view.generations)
27612761

27622762
if src_allocated_gens > (dest_view.limit - dest_allocated_gens):
27632763
return False

plugins/modules/zos_fetch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ def _fetch_gdg(self, src, binary, encoding=None):
719719
dir_path = tempfile.mkdtemp()
720720

721721
data_group = gdgs.GenerationDataGroupView(src)
722-
for current_gds in data_group.generations():
722+
for current_gds in data_group.generations:
723723
if current_gds.organization in data_set.DataSet.MVS_SEQ:
724724
self._fetch_mvs_data(
725725
current_gds.name,

plugins/modules/zos_mvs_raw.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,8 +2802,6 @@ def resolve_data_set_names(dataset, disposition, type):
28022802
Data set name to determine if is a GDS relative name or regular name.
28032803
disposition : str
28042804
Disposition of data set for it creation.
2805-
type : str
2806-
Type of dataset
28072805
Returns
28082806
-------
28092807
str
@@ -2820,9 +2818,11 @@ def resolve_data_set_names(dataset, disposition, type):
28202818
if data_set.DataSet.is_gds_positive_relative_name(dataset):
28212819
if disp == "new":
28222820
if type:
2823-
return str(datasets.create(dataset, type).name), "shr"
2821+
new_generation = datasets.create(name=dataset, dataset_type=type)
2822+
return new_generation.name, "shr"
28242823
else:
2825-
return str(datasets.create(dataset, "seq").name), "shr"
2824+
new_generation = datasets.create(name=dataset, dataset_type="seq")
2825+
return new_generation.name, "shr"
28262826
else:
28272827
raise ("To generate a new GDS as {0} disposition 'new' is required.".format(dataset))
28282828
else:

plugins/modules/zos_stat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ def query(self):
22322232
'order': self.gdg_view.order,
22332233
'purge': self.gdg_view.purge,
22342234
'extended': self.gdg_view.extended,
2235-
'active_gens': [generation.name for generation in self.gdg_view.generations()]
2235+
'active_gens': [generation.name for generation in self.gdg_view.generations]
22362236
}
22372237

22382238
# Now we call LISTCAT to get the creation time.

tests/functional/modules/test_zos_archive_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def test_mvs_archive_single_data_set_remove_target(ansible_zos_module, ds_format
727727
# Assert src_data_set is removed
728728
cmd_result = hosts.all.shell(cmd = f"dls '{src_data_set}'")
729729
for c_result in cmd_result.contacted.values():
730-
assert f"BGYSC1103E No datasets match pattern: {src_data_set}." in c_result.get("stderr")
730+
assert f"BGYSC1103E No datasets match pattern: {src_data_set}" in c_result.get("stderr")
731731
finally:
732732
hosts.all.zos_data_set(name=src_data_set, state="absent")
733733
hosts.all.zos_data_set(name=archive_data_set, state="absent")

0 commit comments

Comments
 (0)