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

Export/Import survey multiple choice issue #8

Closed
przemkalit opened this issue Sep 19, 2024 · 4 comments · Fixed by #23
Closed

Export/Import survey multiple choice issue #8

przemkalit opened this issue Sep 19, 2024 · 4 comments · Fixed by #23
Labels
bug Something isn't working filetree

Comments

@przemkalit
Copy link
Contributor

przemkalit commented Sep 19, 2024

Summary

I've discovered that when a survey with multiple-choice questions is exported with JT/WF and then imported, the multiple-choice gets broken - it has only one choice.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version

ansible [core 2.15.8]

ansible-galaxy collection list
Collection                     Version
------------------------------ -------
ansible.controller                        4.5.10
infra.controller_configuration 2.9.0
  • ansible installation method: EE

OS / ENVIRONMENT

RH 9.4

Desired Behavior

Survey has a list of choices:

A
B
C
D

Actual Behavior

Survey has a one choice:

A/nB/nC/nD

STEPS TO REPRODUCE

Remark: the object with survey must be migrated from ATP to AAP using upgrade method.

  1. Create JT with survey on ATP with multiple choice question, add at least two answers.
  2. Upgrade ATP to AAP
  3. Export the JT
  4. Import the JT
@przemkalit przemkalit added the bug Something isn't working label Sep 19, 2024
@przemkalit
Copy link
Contributor Author

Ok the problem is related to survey that are migrated from ansible tower, in the UI survey is working after migration but in the API is in the old state. Closing the issue.

@przemkalit
Copy link
Contributor Author

przemkalit commented Sep 27, 2024

Reopen it, we identified that the issue is produced by this part of the code:
templates/job_template.j2 (the same for WF)

{% set survey_spec_contents = query(controller_api_plugin, current_job_templates_asset_value.related.survey_spec,
                                    host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)[0] |
                                    from_yaml | to_nice_yaml(indent=2,width=500) | regex_replace("\n\n[ ]*", "\\\\n") | indent(width=6, first=False) | replace("'{{", "!unsafe \'{{") | replace("^$", "") | replace("$encrypted$", "") | replace("'", '"')
-%}

Somehow saving to file, modify the survey in a way that when it is loaded with filetree_read and dispatch, it import into
controller multiselect objects like in the first post.

@djdanielsson djdanielsson transferred this issue from redhat-cop/infra.aap_configuration Oct 15, 2024
@ivarmu
Copy link
Contributor

ivarmu commented Oct 30, 2024

I'm unable to reproduce this in a branch I'm developing tests for the existing roles. Can we close this issue?

@przemkalit
Copy link
Contributor Author

To be honest this bug is weird because it happens only when we save the object with survey into the file, when we tested without saving the file, the survey was okay.

But we have a similar bug:

When we define textarea with default answer:
object_example
object2_example

After exporting object and importing the textarea is changed into:
object_example\nobject2_example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working filetree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants