Awx: Default value for webhook_service is not listed

Created on 18 Jun 2020  路  4Comments  路  Source: ansible/awx

ISSUE TYPE
  • Bug Report
SUMMARY

Related to #5099

Current OPTIONS for job_templates output doesn't have default listed as "default": "" for webhook_service, which have required: false.

Default is expected to be listed within the API since it is not required -

            "webhook_service": {
                "type": "choice",
                "required": false,
                "label": "Webhook service",
                "help_text": "Service that webhook requests will be accepted from",
                "filterable": true,
                "choices": [
                    [
                        "",
                        "---------"
                    ],
                    [
                        "github",
                        "GitHub"
                    ],
                    [
                        "gitlab",
                        "GitLab"
                    ]
                ]
            },
ENVIRONMENT

AWX version: 11.2.0
AWX install method: N/A
Ansible version: N/A
Operating System:
Web Browser:

api needs_devel bug

All 4 comments

@ryanpetrello can you weigh in on this?

Nope, I'm not familiar with the change that affected this cc @AlanCoding @jbradberry @elyezer

This skip field behavior is coming from Django REST Framework itself, and thus this piece of metadata should be missing on all of our fields that have an empty default since we aren't overriding it anywhere.

https://github.com/ansible/awx/blob/a26df3135b73290951c45a2a3903849517a44c72/awx/api/metadata.py#L88-L96

https://github.com/encode/django-rest-framework/blob/aed74961ba03e3e6f53c468353f4e255eb788555/rest_framework/fields.py#L501-L503

This looks easy enough to fix if we want this change, but it will affect all currently skipped fields, not just webhook_service.

I take that back, ultimately the field itself is refusing to return a value when get_default is called on it.

Was this page helpful?
0 / 5 - 0 ratings