Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when Basic authentication is disabled #14790

Open
6 of 11 tasks
kk-at-redhat opened this issue Jan 21, 2024 · 1 comment
Open
6 of 11 tasks

Better error message when Basic authentication is disabled #14790

kk-at-redhat opened this issue Jan 21, 2024 · 1 comment
Labels
community component:api component:awx_collection issues related to the collection for controlling AWX type:bug

Comments

@kk-at-redhat
Copy link

kk-at-redhat commented Jan 21, 2024

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

Show meaningful message when trying to use Basic authentication but unable to authenticate because it's disabled in Controller settings.

AWX version

23.2.0

Select the relevant components

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

Installation method

docker development environment

Modifications

no

Ansible version

2.14.2

Operating system

Red Hat Enterprise Linux release 9.1 (Plow)

Web browser

Chrome

Steps to reproduce

Disable Basic authentication in AAP settings. Try to use one of ansible.controller modules specifying username and password, for example:

    - name: Get all credential types from AAP
      ansible.controller.export:
        controller_username: "{{ aap_config_user }}"
        controller_password: "{{ aap_config_pass }}"
        controller_host: "{{ aap_config_host }}"
        credential_types: 'all'
        validate_certs: false

Expected results

Meaningful error message saying "failed to authenticate" or "incorrect credentials" or "unable to use specified authentication method".

Actual results

Exception that doesn't help to understand what failed.

msg: This endpoint raised an error: /api/v2/credentials
exception:
  File /tmp/ansible_ansible.controller.export_payload_c2dy_i7_/ansible_ansible.controller.export_payload.zip/ansible_collections/ansible/controller/plugins/modules/export.py, line 185, in main
  File /tmp/ansible_ansible.controller.export_payload_c2dy_i7_/ansible_ansible.controller.export_payload.zip/ansible_collections/ansible/controller/plugins/module_utils/controller_api.py, line 282, in exit_jsonn super().exit_json(**kwargs)
  File /tmp/ansible_ansible.controller.export_payload_c2dy_i7_/ansible_ansible.controller.export_payload.zip/ansible/module_utils/basic.py, line 1514, in exit_json sys.exit(0)

Additional information

No response

@fosterseth
Copy link
Member

good catch, I agree there should be an authentication error message in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community component:api component:awx_collection issues related to the collection for controlling AWX type:bug
Projects
None yet
Development

No branches or pull requests

2 participants