Skip to content

Commit 3e7ec31

Browse files
AndreMarcel99André Marcel Gutiérrez Benítezfernandofloresgrexemin
authored
[Enabler][2147-2149]update_job_modules_interfaces (#2208)
* Test * Modify action job submit * Replace structure for empty jobs * Modify structure * Modify test to properly test new interface * Modify test on base of job submit new interface * Be alignt * Modify job submit * Add fragment * Better fragment * Update documentation * Fix commit * Fix documentation * Keep documentation * Replace job submit * Fix sanity * Fix sanity * Return values * Return values to module * Return values to test suite and empty response * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Fernando Flores <[email protected]> * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Fernando Flores <[email protected]> * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Fernando Flores <[email protected]> * Fix job submit * Validate test case * Validate test case * Validate test case * Validate test case * Validate test case * Validate test case * Validate test case * Update changelogs/fragments/2204-Update_zos_job_query_module.yml Co-authored-by: Alex Moreno <[email protected]> * Update plugins/modules/zos_job_submit.py Co-authored-by: Fernando Flores <[email protected]> * Update plugins/modules/zos_job_submit.py Co-authored-by: Fernando Flores <[email protected]> * Update plugins/modules/zos_job_submit.py Co-authored-by: Alex Moreno <[email protected]> * Update plugins/modules/zos_job_submit.py Co-authored-by: Alex Moreno <[email protected]> * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Alex Moreno <[email protected]> * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Alex Moreno <[email protected]> * Update changelogs/fragments/2208_update_job_modules_interfaces.yml Co-authored-by: Alex Moreno <[email protected]> --------- Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]> Co-authored-by: Fernando Flores <[email protected]> Co-authored-by: Alex Moreno <[email protected]>
1 parent 0a6c24c commit 3e7ec31

File tree

9 files changed

+1455
-456
lines changed

9 files changed

+1455
-456
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
breaking_changes:
2-
- zos_job_query - Return value ``message`` is deprecated in favor of ``msg``. Return value ``steps`` are no longer under `` but is now included under jobs.
2+
- zos_job_query - Return field ``message`` is deprecated in favor of ``msg``. Return field ``steps`` is no longer under ``ret_code`` but is now included under ``jobs``.
33
(https://github.com/ansible-collections/ibm_zos_core/pull/2204).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
breaking_changes:
2+
- zos_job_output - Option name ``ddname`` is substituted for ``dd_name``, but ``ddname`` is kept as an alias. Return value ``changed`` is always returned and return value ``steps`` are no longer under ``ret_code``
3+
but is now included under `jobs`. Return value ``ddnames`` is replaced by ``dds`` and value ``ddname`` under ``ddnames`` is replaced by ``dd_name``.
4+
(https://github.com/ansible-collections/ibm_zos_core/pull/2208).
5+
- zos_job_submit - Interface value ``location`` is replace for ``remote_src`` in a bool value and ``wait_time_s`` is replaced for ``wait_time``.
6+
Return value ``ddnames`` replaced by ``dds`` and value ``ddname`` under ``ddnames`` is replace by ``dd_name``. Now all values are returned under ``jobs`` except ``changed``.
7+
(https://github.com/ansible-collections/ibm_zos_core/pull/2208).
8+
9+
trivial:
10+
- test/zos_job_query_func.py - Update test validation to new values for job submit. Return value ``steps`` are no longer under `ret_code`
11+
but is now included under `jobs`.
12+
(https://github.com/ansible-collections/ibm_zos_core/pull/2208).

plugins/action/zos_job_submit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ def run(self, tmp=None, task_vars=None):
4545
module_args = self._task.args.copy()
4646

4747
use_template = _process_boolean(module_args.get("use_template"))
48-
location = module_args.get("location")
49-
if use_template and location != "local":
48+
remote_src = module_args.get("remote_src")
49+
if use_template and remote_src:
5050
result.update(dict(
5151
failed=True,
5252
changed=False,
53-
msg="Use of Jinja2 templates is only valid for local files. Location is set to '{0}' but should be 'local'".format(location)
53+
msg="Use of Jinja2 templates is only valid for local files. remote_src is set to '{0}' but should be False".format(remote_src)
5454
))
5555
return result
5656

57-
if location == "local":
57+
if not remote_src:
5858

5959
source = self._task.args.get("src", None)
6060

plugins/module_utils/job.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def _job_not_found(job_id, owner, job_name, dd_name):
167167
job_not_found_msg = "with the name {0}".format(job_name.upper())
168168
job = {}
169169

170+
job["job_not_found"] = True
170171
job["job_id"] = job_id
171172
job["job_name"] = job_name
172173
job["subsystem"] = None
@@ -175,24 +176,36 @@ def _job_not_found(job_id, owner, job_name, dd_name):
175176
job["cpu_time"] = None
176177
job["execution_node"] = None
177178
job["origin_node"] = None
179+
job["content_type"] = None
180+
job["creation_date"] = None
181+
job["creation_time"] = None
182+
job["execution_time"] = None
183+
job["job_class"] = None
184+
job["svc_class"] = None
185+
job["priority"] = None
186+
job["asid"] = None
187+
job["queue_position"] = None
188+
job["program_name"] = None
178189

179190
job["ret_code"] = {}
180191
job["ret_code"]["msg"] = None
181192
job["ret_code"]["code"] = None
182193
job["ret_code"]["msg_code"] = None
183194
job["ret_code"]["msg_txt"] = "The job {0} could not be found.".format(job_not_found_msg)
195+
job["steps"] = []
184196

185-
job["class"] = ""
197+
job["class"] = None
186198

187-
job["ddnames"] = []
199+
job["dds"] = []
188200
dd = {}
189-
dd["ddname"] = dd_name
190-
dd["record_count"] = "0"
191-
dd["id"] = ""
201+
dd["dd_name"] = dd_name
202+
dd["record_count"] = 0
203+
dd["id"] = None
192204
dd["stepname"] = None
193-
dd["procstep"] = ""
194-
dd["byte_count"] = "0"
195-
job["ddnames"].append(dd)
205+
dd["procstep"] = None
206+
dd["byte_count"] = 0
207+
dd["content"] = None
208+
job["dds"].append(dd)
196209

197210
jobs.append(job)
198211

@@ -351,8 +364,8 @@ def _get_job_status(job_id="*", owner="*", job_name="*", dd_name=None, dd_scan=T
351364
job = {}
352365
job["job_id"] = entry.job_id
353366
job["job_name"] = entry.name
354-
job["subsystem"] = ""
355-
job["system"] = ""
367+
job["subsystem"] = None
368+
job["system"] = None
356369
job["owner"] = entry.owner
357370
job["cpu_time"] = None
358371
job["execution_node"] = None
@@ -380,9 +393,9 @@ def _get_job_status(job_id="*", owner="*", job_name="*", dd_name=None, dd_scan=T
380393
job["creation_time"] = str(entry.creation_datetime)[12:]
381394
job["queue_position"] = entry.queue_position
382395
job["program_name"] = entry.program_name
383-
job["class"] = ""
396+
job["class"] = None
384397
job["steps"] = []
385-
job["ddnames"] = []
398+
job["dds"] = []
386399
job["duration"] = duration
387400
if hasattr(entry, "execution_time"):
388401
job["execution_time"] = entry.execution_time
@@ -444,7 +457,7 @@ def _get_job_status(job_id="*", owner="*", job_name="*", dd_name=None, dd_scan=T
444457
if dd_name not in single_dd["dd_name"]:
445458
continue
446459
else:
447-
dd["ddname"] = single_dd["dd_name"]
460+
dd["dd_name"] = single_dd["dd_name"]
448461

449462
if "records" in single_dd:
450463
dd["record_count"] = single_dd["records"]
@@ -495,8 +508,8 @@ def _get_job_status(job_id="*", owner="*", job_name="*", dd_name=None, dd_scan=T
495508

496509
job["steps"].extend(_parse_steps(tmpcont))
497510

498-
job["ddnames"].append(dd)
499-
if len(job["class"]) < 1:
511+
job["dds"].append(dd)
512+
if job["class"] is None:
500513
job["class"] = entry.job_class
501514

502515
if job["system"] is None:
@@ -545,7 +558,7 @@ def _ddname_pattern(contents, resolve_dependencies):
545558
re.IGNORECASE,
546559
):
547560
raise ValueError(
548-
'Invalid argument type for "{0}". Expected "ddname_pattern"'.format(
561+
'Invalid argument type for "{0}". Expected "dd_name_pattern"'.format(
549562
contents
550563
)
551564
)

0 commit comments

Comments
 (0)