Skip to content

Better error message when incorrect Private Hub credentials specified #353

Open
@kk-at-redhat

Description

@kk-at-redhat

Summary

Show meaningful error message when Private Hub credentials are incorrect.

Issue Type

  • Bug Report

Ansible, Collection, Private Automation Hub details

ansible --version
ansible [core 2.14.2]
  config file = None
  configured module search path = ['/home/kk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/kk/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.14 (main, Nov  7 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

ansible-galaxy collection list
Collection             Version
---------------------- -------
ansible.controller     4.4.7
awx.awx                23.2.0
infra.ah_configuration 2.0.4

Private Automation Hub version
Server version 4.6.3
Pulp Ansible Version 0.15.0
UI Version 4.6.3
  • ansible installation method: one of source, pip, OS package, EE
    OS package

OS / ENVIRONMENT

Red Hat Enterprise Linux release 9.1 (Plow)

Desired Behavior

Meaningful error message, for example: "Unable to log in to Private Automation Hub", or perhaps "Failed to authenticate", or "Incorrect username or password"

Actual Behavior

Getting the following error:
"An unhandled exception occurred while running the lookup plugin 'infra.ah_configuration.ah_api'. Error was a <class 'TypeError'>, original message: expected string or bytes-like object. expected string or bytes-like object"

STEPS TO REPRODUCE

Make query via API like so:

- name: Get list of published collections
  ansible.builtin.set_fact:
    published_collections: "{{ query('infra.ah_configuration.ah_api',
                                     'collections',
                                      host=hub_config_host,
                                      username=hub_config_user,
                                      password=hub_config_pass,
                                      verify_ssl=false) }}"

specifying incorrect credentials in hub_config_user/hub_config_pass.

Get an error message that doesn't make any sense:

{
  "msg": "An unhandled exception occurred while running the lookup plugin 'infra.ah_configuration.ah_api'. Error was a <class 'TypeError'>, original message: expected string or bytes-like object. expected string or bytes-like object",
  "_ansible_no_log": false
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions