azimuth-cloud / azimuth-caas-operator

K8s operator to create ansible based clusters using K8s CRDs
Apache License 2.0
1 stars 2 forks source link

Exclude log records without an event #119

Closed mkjpryor closed 6 months ago

mkjpryor commented 6 months ago

Fixes this error, seen in production, where a JSON record produced by Ansible did not have an event:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/kopf/_core/actions/execution.py", line 276, in execute_handler_once
    result = await invoke_handler(
  File "/opt/venv/lib/python3.10/site-packages/kopf/_core/actions/execution.py", line 371, in invoke_handler
    result = await invocation.invoke(
  File "/opt/venv/lib/python3.10/site-packages/kopf/_core/actions/invocation.py", line 116, in invoke
    result = await fn(**kwargs)  # type: ignore
  File "/opt/venv/lib/python3.10/site-packages/azimuth_caas_operator/operator.py", line 258, in cluster_update
    outputs = await ansible_runner.get_outputs_from_job(K8S_CLIENT, update_job)
  File "/opt/venv/lib/python3.10/site-packages/azimuth_caas_operator/utils/ansible_runner.py", line 400, in get_outputs_from_job
    return await _get_job_outputs(client, job)
  File "/opt/venv/lib/python3.10/site-packages/azimuth_caas_operator/utils/ansible_runner.py", line 415, in _get_job_outputs
    if event_details["event"] == "runner_on_ok":
KeyError: 'event'
github-advanced-security[bot] commented 6 months ago

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.