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

Custom credential types with boolean fields cannot be created or edited using the AWX console #7483

Closed
alanbchristie opened this issue Jun 30, 2020 · 2 comments

Comments

@alanbchristie
Copy link

ISSUE TYPE
  • Bug Report
SUMMARY

I am creating custom credential types (and custom credentials) using the Ansible awx.awx collection's awx.awx.tower_credential_type and awx.awx.tower_credential modules. I can create credentials using the tower-cli but not using the AWX console.

You cannot edit existing or create new custom credentials in the console because the SAVE button is never enabled. When I click the checkbox for the boolean field that's presented for a boolean property the text Please enter a value is printed.

Custom credential types that do not contain booleans can be edited and created.

ENVIRONMENT
  • AWX version: 11.2.0
  • AWX install method: kubernetes
  • Ansible version: 2.9.7
  • Operating System: kubernetes
  • Web Browser: Safari or Chrome
STEPS TO REPRODUCE

Create a custom credential type (using the Ansible awx.awx.tower_credential module). Here's a snippet from my playbook that creates my own kubernetes type. The field that causes the problem is verify_ssl: -

- name: Add kubernetes credential type
  awx.awx.tower_credential_type:
    name: kubernetes
    description: Credentials for a Kubernetes/OpenShift cluster
    kind: cloud
    inputs:
      fields:
      - id: name
        type: string
        label: A symbolic name for the cluster
      - id: host
        type: string
        label: API host
      - id: api_key
        type: string
        label: API Key (Token)
        secret: true
      - id: verify_ssl
        type: boolean
        label: Verify SSL
      required:
      - name
      - host
      - api_key
      - verify_ssl
    injectors:
      env:
        K8S_AUTH_NAME: "{{ '{{' }} name {{ '}}' }}"
        K8S_AUTH_HOST: "{{ '{{' }} host {{ '}}' }}"
        K8S_AUTH_API_KEY: "{{ '{{' }} api_key {{ '}}' }}"
        K8S_AUTH_VERIFY_SSL: "{{ '{{' }} verify_ssl {{ '}}' }}"

You can create credentials of this type using the awx.awx.tower_credential module. Here's a snippet that successfully creates instances of the credential that can be used in templates: -

- name: Add kubernetes credential
  awx.awx.tower_credential:
    name: "{{ item.name }}"
    credential_type: kubernetes
    description: "{{ item.description|default('', true) }}"
    organization: "{{ tower.organisation }}"
    inputs:
      name: "{{ item.name }}"
      host: "{{ item.host }}"
      api_key: "{{ item.api_key }}"
      verify_ssl: "{{ item.verify_ssl|bool }}"

...but you will find that you cannot edit existing ones or create new ones using the AWX console.

EXPECTED RESULTS

I expect to be able to edit and create custom credentials that contain booleans using the AWX console.

ACTUAL RESULTS

The SAVE button is never enabled for custom credentials that contain booleans - so they cannot be created or existing ones changed.

ADDITIONAL INFORMATION

n/a

@AlanCoding
Copy link
Member

By "console" I take it you mean the UI.

I am able to replicate

Screen Shot 2020-06-30 at 10 27 01 PM

Even if you had created the credential type by other means, I would expect the same results, because this is due to the combination of inputs definition.

@jakemcdermott
Copy link
Contributor

#7537 (comment)

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

No branches or pull requests

5 participants