ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.08k stars 3.43k forks source link

Misconfigured LOG_AGGREGATOR_URL can cause dispatcher to go into a crash loop. #13823

Open mabashian opened 1 year ago

mabashian commented 1 year ago

ISSUE TYPE

Bug Report SUMMARY Misconfiguration of the logging url can cause dispatcher to go into a crash loop.

ENVIRONMENT

AWX version: devel AWX install method: setup.sh Ansible version: 2.9 Operating System: Web Browser:

STEPS TO REPRODUCE

misconfigure logging url with something like http:s//test.com enable logging restart awx launch jobs

EXPECTED RESULTS

Misconfigured logger should not cause a crash loop.

ACTUAL RESULTS

Traceback is in awx-dispatcher.log

Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/utils/external_logging.py", line 57, in construct_rsyslog_conf_template if parsed.port: File "/usr/lib64/python3.6/urllib/parse.py", line 169, in port port = int(port, 10) ValueError: invalid literal for int() with base 10: 's'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/awx-manage", line 11, in load_entry_point('awx==3.8.2', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/init.py", line 154, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, *cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/run_dispatcher.py", line 66, in handle consumer.run() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/dispatch/worker/base.py", line 153, in run self.worker.on_start()

ADDITIONAL INFORMATION

Looks like this try except block is written in a way which doesn't account for no LOGGING_AGGREGATOR_PORT being configured:

https://github.com/ansible/awx/blob/devel/awx/main/utils/external_logging.py#L61

kloud-byun commented 1 year ago

https://github.com/ansible/awx/pull/13829 Would this work?