Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

[Survey] Text field uses null instead of empty when left blank #16205

@Luke239847

Description

@Luke239847

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 [email protected] instead.)

Bug Summary

When an optional Survey question of type Text is left blank, AWX uses the value null in the job template extra vars. This is problematic because playbooks often rely on the extra vars and if/how they are defined. Storing null changes conditional behavior and can break workflows that expect empty or missing values for optional text inputs.

AWX version

24.6.1

Select the relevant components

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

Installation method

kubernetes

Modifications

no

Ansible version

2.19.4

Operating system

No response

Web browser

No response

Steps to reproduce

  1. Create or edit a Job Template, for e.g. following code:
    ---
    - name: Print survey_variable
    hosts: localhost
    gather_facts: false
    tasks:
    - name: Print survey_variable
    ansible.builtin.debug:
    msg: "{{ survey_variable }}"
    - name: Check if survey_variable is defined
    ansible.builtin.debug:
    msg: "survey_variable is defined"
    when: survey_variable is defined
  2. Add an optional Survey with a Text question
Image
  1. Launch the Job Template.
  2. In the survey modal, leave the text field empty and proceed to start the job.
  3. Check the result
Image Image

Expected results

An empty string, as it should be according to the documentation. This would also be the same behavior as when the variable is specified directly as a variable (without a Survey) in AWX or executed locally.

Image Image

Actual results

The variable is present with value null of type string

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions