ansible/awx

awx.awx.schedule - Specifying unified_job_template as ID doesn't work

Open

#14,458 opened on Sep 18, 2023

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Python (13,071 stars) (3,333 forks)batch import
communitycomponent:awx_collectionhelp wantedtype:bug

Description

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to security@ansible.com instead.)

Bug Summary

Per the docs, the unified_job_template parameter can be specified as a Name, ID, or URL. However, specifying an ID thrown an exception in collection versions >19.2.2.

I believe the problem is caused by this change https://github.com/ansible/awx/pull/11135/files#diff-51b779436b7298bec9ef390eb72bb99b2d67c558757579c931908a1aa8d7662bL196

AWX version

21.14.0

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

docker development environment

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

Try scheduling a job using the job template ID as such:

    - name: Test schedule job w/ ID
      vars:
        start_time: "2025-04-03 12:02:14"
      awx.awx.schedule:
        name: "Test w/ ID"
        unified_job_template: '30'
        rrule: "{{ query('awx.awx.schedule_rrule', 'minute', start_date=start_time, timezone='UTC', every='1', end_on='1') }}"

Expected results

The job should be scheduled

Actual results

"exception": "Traceback (most recent call last):\n File "/home/runner/.ansible/tmp/ansible-tmp-1695053652.058952-44-236635489272730/AnsiballZ_schedule.py", line 107, in \n _ansiballz_main()\n File "/home/runner/.ansible/tmp/ansible-tmp-1695053652.058952-44-236635489272730/AnsiballZ_schedule.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/runner/.ansible/tmp/ansible-tmp-1695053652.058952-44-236635489272730/AnsiballZ_schedule.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.awx.awx.plugins.modules.schedule', init_globals=dict(_module_fqn='ansible_collections.awx.awx.plugins.modules.schedule', _modlib_path=modlib_path),\n File "/usr/lib64/python3.9/runpy.py", line 225, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_awx.awx.schedule_payload_tnadnbuu/ansible_awx.awx.schedule_payload.zip/ansible_collections/awx/awx/plugins/modules/schedule.py", line 362, in \n File "/tmp/ansible_awx.awx.schedule_payload_tnadnbuu/ansible_awx.awx.schedule_payload.zip/ansible_collections/awx/awx/plugins/modules/schedule.py", line 266, in main\nTypeError: 'NoneType' object is not subscriptable\n",

Additional information

Tested with collection versions 19.4.0 and 23.1.0 with the same result (line number in exception differ though). 'Actual results' were from version 23.1.0 (ie latest)

Specifying the job template by name, rather than ID, works as expected.

Contributor guide