controller_configuration icon indicating copy to clipboard operation
controller_configuration copied to clipboard

Survey import/export - multi select answer issue default choices

Open przemkalit opened this issue 1 year ago • 0 comments

Summary

When importing the exported (with filetree_create) job template using this collection we are receiving error:

Failed to update survey: Default choice must be answered from the choices listed.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version

ansible [core 2.16.2]
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.1 (main, Dec 18 2023, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

ansible-galaxy collection list
Collection              Version
----------------------- -------
ansible.posix           1.5.4
ansible.windows         2.2.0
awx.awx                 23.6.0
containers.podman       1.11.0
kubernetes.core         3.0.0
redhatinsights.insights 1.2.2
theforeman.foreman      4.0.0

Controller version  4.5.6 

  • ansible installation method: EE

OS / ENVIRONMENT

Red Hat

Desired Behavior

Job template is imported with proper default choices.

Actual Behavior

{
  "started": 1,
  "finished": 1,
  "stdout": "",
  "stderr": "",
  "stdout_lines": [],
  "stderr_lines": [],
  "ansible_job_id": "j481293389279.902",
  "results_file": "/root/.ansible_async/j481293389279.902",
  "msg": "Failed to update survey: Default choice must be answered from the choices listed.",
...
      "survey_spec": {
        "description": "",
        "name": "",
        "spec": [
          {
            "choices": [
              "organizations",
              "job_templates",
              "projects",
              "workflow_job_templates",
              "credentials",
              "notification_templates",
              "instance_groups",
              "credential_types",
              "labels",
              "users",
              "teams",
              "roles",
              "hosts"
            ],
            "default": "organizations\\njob_templates\\nprojects\\nworkflow_job_templates\\ncredentials\\nnotification_templates\\ninstance_groups\\ncredential_types\\nlabels\\nusers\\nteams\\nroles\\nhosts",
            "max": 1024,
            "min": 0,
            "new_question": false,
            "question_description": "",
            "question_name": "Objects to restore",
            "required": true,
            "type": "multiselect",
            "variable": "input_tag"
          }

STEPS TO REPRODUCE

  1. Create job template with survey that have a multi select answer.
  2. Pick two or more answers for the question.
  3. Export the job with filetree_create role.
  4. Import using filetree_read and dispatch roles

backup.yaml

---
- name: Backup all objects
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    controller_oauthtoken: "{{ lookup('ansible.builtin.env', 'TOWER_OAUTH_TOKEN') }}"
    controller_hostname: "{{ lookup('ansible.builtin.env', 'TOWER_HOST') }}"
    controller_validate_certs: "{{ lookup('ansible.builtin.env', 'TOWER_VERIFY_SSL') }}"
  roles:
    - infra.controller_configuration.filetree_create

restore.yaml

---
- name: Restore all objects
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    controller_oauthtoken: "{{ lookup('ansible.builtin.env', 'TOWER_OAUTH_TOKEN) }}"
    controller_hostname: "{{ lookup('ansible.builtin.env', 'TOWER_HOST') }}"
    controller_validate_certs: "{{ lookup('ansible.builtin.env', 'TOWER_VERIFY_SSL') }}"
  tasks:
    - name: Include vars from control_vars directory
      ansible.builtin.include_vars:
        dir: "{{ dir_orgs_vars }}"
        extensions:
          - "yml"
          - "yaml"

    - ansible.builtin.include_role:
      name: infra.controller_configuration.filetree_read
    
    - ansible.builtin.include_role:
      name: infra.controller_configuration.dispatch

przemkalit avatar Jun 25 '24 10:06 przemkalit