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

Default for webhook_service is not in field choices and not accepted #5099

Closed
AlanCoding opened this issue Oct 24, 2019 · 1 comment
Closed

Comments

@AlanCoding
Copy link
Member

ISSUE TYPE
  • Bug Report
SUMMARY

The OPTIONS for job_templates is not self-consistent for the field webhook_service.

This breaks the tower-cli send command, assuming the data comes from the receive command. A hack is in progress for this, but it would be better to change behavior from API moving forward.

ENVIRONMENT
  • AWX version: 8.0.0
  • AWX install method: N/A
  • Ansible version: N/A
  • Operating System:
  • Web Browser:
STEPS TO REPRODUCE

Of particular interest here is the sequence of tower-cli receive, saving that to a file, and using it in tower-cli send.

EXPECTED RESULTS

Data given from the API is consistent with OPTIONS

ACTUAL RESULTS

OPTIONS for job_templates gives

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

The receive command always gives webhook_credential in the asset data because it has no default. Without a default, it cannot be determined if the field has been set.

The send command gives

JOB TEMPLATE [SRtest] ***************************************************************************************************************************************************************
Value  is not a valid choice for option webhook_service for job_template SRtest. Options: ['github', 'GitHub', 'gitlab', 'GitLab']
ADDITIONAL INFORMATION

ansible/tower-cli#741

Ping @jbradberry, @john-westcott-iv

In terms of CLI design in general, @ryanpetrello I find the ability to determine if a field has a non-default value is a powerful tool. This is one of the things I most like about the send/receive commands. I would even prefer that for compact representations of resources for human consumption.

@elyezer
Copy link
Member

elyezer commented Feb 26, 2020

Did de following to verify this:

  1. Created both a job template and a workflow job template
  2. For each resource created on 1, edited the webhook_service field to github, then gitlab and finally to "" (empty string). Everything succeeded as expected when using PUT requests.

Also did an OPTIONS request to both /api/v2/job_templates/ and /api/v2/workflow_job_templates and the information for the webhook_service displayed all the accepted options: github, gitlab and "" (emptry string)

With all that we can consider this issue as being verified.

@elyezer elyezer closed this as completed Feb 26, 2020
AlanCoding pushed a commit to AlanCoding/awx that referenced this issue Jun 23, 2021
Expand sos report plugin compatibility
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

4 participants