diff --git a/plugins/modules/zos_archive.py b/plugins/modules/zos_archive.py index ffe5a7d34..cbe96b65d 100644 --- a/plugins/modules/zos_archive.py +++ b/plugins/modules/zos_archive.py @@ -737,8 +737,6 @@ def __init__(self, module): self.expanded_sources = self.expand_mvs_paths(self.sources) self.expanded_exclude_sources = self.expand_mvs_paths(module.params['exclude']) self.sources = sorted(set(self.expanded_sources) - set(self.expanded_exclude_sources)) - # self.sources is a list of MVSDatasets - self.sources = [data_set.DataSet.resolve_gds_absolute_name(ds) if data_set.DataSet.is_gds_relative_name(ds) else ds for ds in self.sources] self.tmp_data_sets = list() self.dest_data_set = module.params.get("dest_data_set") self.dest_data_set = dict() if self.dest_data_set is None else self.dest_data_set @@ -787,22 +785,7 @@ def _create_dest_data_set( Returns: str: Name of the temporary data set created. """ - arguments = {} - arguments.update( - name=name, - data_set_type=type, - space_primary=space_primary, - space_secondary=space_secondary, - space_type=space_type, - record_format=record_format, - record_length=record_length, - block_size=block_size, - directory_blocks=directory_blocks, - sms_storage_class=sms_storage_class, - sms_data_class=sms_data_class, - sms_management_class=sms_management_class, - volumes=volumes, - ) + arguments = locals() if name is None: if tmp_hlq: hlq = tmp_hlq @@ -816,21 +799,15 @@ def _create_dest_data_set( if record_length is None: arguments.update(record_length=80) if type is None: - arguments.update(data_set_type="seq") + arguments.update(type="seq") if space_primary is None: arguments.update(space_primary=5) if space_secondary is None: arguments.update(space_secondary=3) if space_type is None: arguments.update(space_type="m") - - ds = data_set.MVSDataSet(**arguments) - changed = data_set.DataSet.ensure_present( - data_set=ds, - replace=replace, - tmp_hlq=tmp_hlq, - force=force - ) + arguments.pop("self") + changed = data_set.DataSet.ensure_present(**arguments) return arguments["name"], changed def create_dest_ds(self, name): @@ -842,8 +819,19 @@ def create_dest_ds(self, name): name {str} - name of the newly created data set. """ record_length = XMIT_RECORD_LENGTH if self.format == "xmit" else AMATERSE_RECORD_LENGTH - ds = data_set.MVSDataSet(name=name, data_set_type='seq', record_format='fb', record_length=record_length) - data_set.DataSet.ensure_present(data_set=ds, replace=True) + data_set.DataSet.ensure_present(name=name, replace=True, type='seq', record_format='fb', record_length=record_length) + # changed = data_set.DataSet.ensure_present(name=name, replace=True, type='seq', record_format='fb', record_length=record_length) + # cmd = "dtouch -rfb -tseq -l{0} {1}".format(record_length, name) + # rc, out, err = self.module.run_command(cmd) + + # if not changed: + # self.module.fail_json( + # msg="Failed preparing {0} to be used as an archive".format(name), + # stdout=out, + # stderr=err, + # stdout_lines=cmd, + # rc=rc, + # ) return name def dump_into_temp_ds(self, temp_ds): diff --git a/tests/functional/modules/test_zos_archive_func.py b/tests/functional/modules/test_zos_archive_func.py index 2b4318768..f6b1140fa 100644 --- a/tests/functional/modules/test_zos_archive_func.py +++ b/tests/functional/modules/test_zos_archive_func.py @@ -342,7 +342,7 @@ def test_uss_archive_remove_targets(ansible_zos_module, format): ] ) @pytest.mark.parametrize( - "record_length", [80] + "record_length", [80, 120] ) @pytest.mark.parametrize( "record_format", ["fb", "vb"], @@ -354,6 +354,7 @@ def test_mvs_archive_single_dataset(ansible_zos_module, format, data_set, record archive_data_set = get_tmp_ds_name() HLQ = "ANSIBLE" # Clean env + hosts.all.zos_data_set(name=src_data_set, state="absent") hosts.all.zos_data_set(name=archive_data_set, state="absent") # Create source data set hosts.all.zos_data_set( @@ -420,7 +421,7 @@ def test_mvs_archive_single_dataset(ansible_zos_module, format, data_set, record ] ) @pytest.mark.parametrize( - "record_length", [80] + "record_length", [80, 120] ) @pytest.mark.parametrize( "record_format", ["fb", "vb"], @@ -432,6 +433,7 @@ def test_mvs_archive_single_dataset_use_adrdssu(ansible_zos_module, format, data src_data_set = get_tmp_ds_name() HLQ = "ANSIBLE" # Clean env + hosts.all.zos_data_set(name=src_data_set, state="absent") hosts.all.zos_data_set(name=archive_data_set, state="absent") # Create source data set hosts.all.zos_data_set( @@ -505,6 +507,7 @@ def test_mvs_archive_single_data_set_remove_target(ansible_zos_module, format, d src_data_set = get_tmp_ds_name() HLQ = "ANSIBLE" # Clean env + hosts.all.zos_data_set(name=src_data_set, state="absent") hosts.all.zos_data_set(name=archive_data_set, state="absent") # Create source data set hosts.all.zos_data_set(