Restore backup failing due to regex not properly scaped

Bug #1983475 reported by Thiago Paiva Brito
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Thiago Paiva Brito

Bug Description

Brief Description
-----------------
After the merge of [1], the restore playbook fails with a message saying "We could be wrong, but this one looks like it might be an issue with missing quotes" at either L243 or L265. This is due to backslash not properly scaped for yaml syntax.

[1]https://review.opendev.org/c/starlingx/ansible-playbooks/+/848770

Severity
--------
Critical: System/Feature is not usable due to the defect

Steps to Reproduce
------------------
Run the restore playbook with a valid backup archive

Expected Behavior
------------------
Restore playbook fails at either "Check if there is openldap (CentOS) configuration on backup" or "Check if there is ldap configuration on backup"

Actual Behavior
----------------
Restore playbook executes to the end

Reproducibility
---------------
3/3

System Configuration
--------------------
All systems

Branch/Pull Time/Commit
-----------------------
2022-08-03

Last Pass
---------
2022-08-02

Timestamp/Logs
--------------
2022-08-02 18:51:54,512 p=10813 u=sysadmin | ERROR! Syntax Error while loading YAML.
  found unknown escape character

The error appears to have been in '/usr/share/ansible/stx-ansible/playbooks/roles/restore-platform/restore-more-data/tasks/main.yml': line 243, column 57, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Check if there is openldap (CentOS) configuration on backup
  shell: "tar -tf {{ restore_data_file }} | grep -E 'etc\/openldap\/.*'"
                                                        ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

Test Activity
-------------
Feature Testing

Workaround
----------
Change the playbook and re-run backup

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ansible-playbooks (master)
Changed in starlingx:
status: New → In Progress
Changed in starlingx:
assignee: nobody → Thiago Paiva Brito (outbrito)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ansible-playbooks (master)

Reviewed: https://review.opendev.org/c/starlingx/ansible-playbooks/+/852020
Committed: https://opendev.org/starlingx/ansible-playbooks/commit/4c8117534fdd3a84934b3815f0b76f74d99a68aa
Submitter: "Zuul (22348)"
Branch: master

commit 4c8117534fdd3a84934b3815f0b76f74d99a68aa
Author: Thiago Brito <email address hidden>
Date: Wed Aug 3 10:01:47 2022 -0300

    Fixing unquoted backslashes for grep -E

    After the merge of [1], the restore playbook fails with a message
    saying "We could be wrong, but this one looks like it might be an issue
    with missing quotes" at either L243 or L265. This is due to backslash
    not properly scaped for yaml syntax.

    [1]https://review.opendev.org/c/starlingx/ansible-playbooks/+/848770

    TEST PLAN
    PASS run restore playbook

    Closes-Bug: #1983475
    Signed-off-by: Thiago Brito <email address hidden>
    Change-Id: Idcb5f5939a2a706afe1da1075397652e55dd37d0

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.8.0 stx.update
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.