awx job monitor returning 400 Bad request

Created on 1 Jul 2020  ·  5Comments  ·  Source: ansible/awx

ISSUE TYPE
  • Bug Report
SUMMARY

When I use awx job monitor, it returns 400 bad request.

அ  ~  awx -v job monitor 1504959      
<output trimmed>
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.jobs.Job'> by url: /api/v2/jobs/1504959/
DEBUG:urllib3.connectionpool:https://tower.engineering.redhat.com:443 "GET /api/v2/jobs/1504959/ HTTP/1.1" 200 8050
DEBUG:awxkit.api.client:"GET https://tower.engineering.redhat.com/api/v2/jobs/1504959/" elapsed: 0:00:00.627698
------Starting Standard Out Stream------
DEBUG:awxkit.api.registry:Retrieved <class 'awxkit.api.pages.jobs.JobEvents'> by url: /api/v2/jobs/1504959/job_events/
DEBUG:urllib3.connectionpool:https://tower.engineering.redhat.com:443 "GET /api/v2/jobs/1504959/job_events/?order_by=start_line&no_truncate=True HTTP/1.1" 400 54
DEBUG:awxkit.api.client:"GET https://tower.engineering.redhat.com/api/v2/jobs/1504959/job_events/?order_by=start_line&no_truncate=True" elapsed: 0:00:00.604766
Traceback (most recent call last):
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/__init__.py", line 25, in run
    cli.parse_resource()
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/client.py", line 167, in parse_resource
    response = self.parse_action(resource)
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/client.py", line 315, in parse_action
    return getattr(page, self.method)(**parsed)
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/custom.py", line 575, in perform
    status = mon(
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/stdout.py", line 107, in monitor
    next_line = fetch(next_line)
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/cli/stdout.py", line 85, in fetch
    for result in events(**payload).json.results:
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/api/pages/page.py", line 396, in get
    return self._create().get(**params)
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/api/pages/page.py", line 275, in get
    page = self.page_identity(r)
  File "/home/bsivasub/.local/lib/python3.8/site-packages/awxkit/api/pages/page.py", line 256, in page_identity
    raise exc.BadRequest(exc_str, data)
awxkit.exceptions.BadRequest: Bad Request (400) received - {'detail': "JobEvent has no field named 'no_truncate'"}
 <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
{"detail": "JobEvent has no field named 'no_truncate'"}

But at the same time, I see awx job stdout is working as expected.

அ  ~  awx -v job stdout 1504959          
<output trimmed>
Identity added: /tmp/awx_1504959_o1m8cf6l/artifacts/1504959/ssh_key_data (/tmp/awx_1504959_o1m8cf6l/artifacts/1504959/ssh_key_data)
Vault password: 

PLAY [rcm_compose_prod] ********************************************************
<output trimmed>
ENVIRONMENT
  • AWX version: 12.0.0
bug

Most helpful comment

awx-version == 15.0.1
Tower 3.5.6

Same for me. When removing no_truncate from cli/stdout.py it works for me, but this is just a workaround digging deep in the code.

def monitor(response, session, print_stdout=True, timeout=None, interval=.25):
    get = response.url.get
    payload = {'order_by': 'start_line'}
  ...

All 5 comments

@sbuvaneshkumar,

Can you share the version output from /api/v2/config/ ?

Are you working with an AWX installation, or a Red Hat Ansible Tower install?

You may want to try upgrading to AWX 13.0.0 - it looks like we potentially addressed this as a bug here:

https://github.com/ansible/awx/commit/e672e68a02d03090db7868fd7ca60613950f9b7e

Hello , I have the same trouble with : awx --version ==> 14.1.0

awx job monitor 748976 -k
------Starting Standard Out Stream------
{"detail": "JobEvent has no field named 'no_truncate'"}

awx-version == 15.0.1
Tower 3.5.6

Same for me. When removing no_truncate from cli/stdout.py it works for me, but this is just a workaround digging deep in the code.

def monitor(response, session, print_stdout=True, timeout=None, interval=.25):
    get = response.url.get
    payload = {'order_by': 'start_line'}
  ...

I have the same error message when trying to monitor a job with awxkit 14.1.0, 15.0.1 and 16.0.0. However, it was a test on job templates based on ansible 2.1 and ansible 2.4. Typically, with awxkit 14.1.0, I have no issue when the job template is based on ansible 2.8. This is consistent with the prerequesite described in https://github.com/ansible/awx/blob/devel/INSTALL.md#prerequisites

Was this page helpful?
0 / 5 - 0 ratings