Skip to content

question_name is exported without quotes in filetree_create #78

@w4hf

Description

@w4hf

Summary

If a job template contains a survey, when filetree_create export the job template it does not add quotes to the question_name key of each question

For example, if a survey question looks like: please chose between: Value1 and Value2
The resulting export will look like :

    survey_spec:
      name: ""
      spec:
        - max: 1024
          min: 0
          type: text
          required: True
          variable: vm_name
          new_question: True
          question_name: please chose between: Value1 and Value2
      description: ""
    become_enabled: false
    diff_mode: false

which is not correct YAML and cause errors when using the generated variable file.

The solution is to quote the value of question_name

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
ansible [core 2.18.12]
  config file = /home/w4hf/projects/CAC/cac-create-24/ansible.cfg
  configured module search path = ['/home/w4hf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.14/site-packages/ansible
  ansible collection location = /home/w4hf/projects/CAC/cac-create-24/collections
  executable location = /usr/bin/ansible
  python version = 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True

ansible-galaxy collection list
# /home/w4hf/projects/CAC/cac-create-24/collections/ansible_collections
Collection                     Version
------------------------------ -------
ansible.controller             4.5.25 
infra.controller_configuration 3.2.0  

Controller version
4.5.25

Desired Behavior

Generated file after export should be valid yaml

Actual Behavior

Exported file is not valid yaml if the survey contains unvalid yaml strings like strings that contains ': '

STEPS TO REPRODUCE

  1. Create a job template with a survey with the following question name
question_name: please chose between: Value1 and Value2
  1. export job_tempaltes using filetree_create

  2. see that question_name has an invalid yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions