Bug 2283506

Summary: regex_escape blocks OS::TripleO::Services::NovaLibvirtLegacy deployment
Product: Red Hat OpenStack Reporter: Alex Stupnikov <astupnik>
Component: openstack-tripleo-heat-templatesAssignee: Bogdan Dobrelya <bdobreli>
Status: CLOSED ERRATA QA Contact: Joe H. Rahme <jhakimra>
Severity: medium Docs Contact:
Priority: medium    
Version: 17.1 (Wallaby)CC: bdobreli, bshephar, jbadiapa, jpretori, ktordeur, mariel, mburns
Target Milestone: z4Keywords: Triaged
Target Release: 17.1   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: openstack-tripleo-heat-templates-14.3.1-17.1.20240919130751.e7c7ce3.el9ost openstack-tripleo-heat-templates-14.3.1-17.1.20240826193747.e7c7ce3.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-21 09:31:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Stupnikov 2024-05-27 14:04:39 UTC
Description of problem:

Command [1] is blocked by error [2] in customer's lab. It looks like this problem is coming from the following play defined in deployment/deprecated/nova/nova-libvirt-container-puppet.yaml:

- name: Switch running image to new image in wrapper script
  shell: |
    sed -i -e 's/{{ old_virtlogd_image.stdout | regex_escape() }}/{{ virtlogd_image | regex_escape() }}/' /var/lib/container-config-scripts/virtlogd_wrapper
  when: old_virtlogd_image.stdout != virtlogd_image

It looks like regex_escape() plugin doesn't escape slashes properly. It may make sense to switch to syntax that is already used in deployment/nova/nova-modular-libvirt-container-puppet.yaml for the same task.

Problem is reproducible using ansible's debug (dots and hyphens are escaped, but not slashes):

  - name: print outcome
    debug: msg="{{ old_virtlogd_image | regex_escape() }}"

TASK [print outcome] ******************************************************************************************************************************************************
ok: [127.0.0.1] => {
    "msg": "registry\\.redhat\\.io/rhosp\\-rhel8/openstack\\-nova\\-libvirt:17\\.1\\.2"
}

[1]
openstack overcloud upgrade run --yes --stack overcloud --tags system_upgrade --limit ControllerLeaf0,ObjectStorageLeaf0,NetworkerLeaf0

[2]
FATAL | Switch running image to new image in wrapper script | compute01 | error={"changed": true, "cmd": "sed -i -e 's/registry\\.redhat\\.io/rhosp\\-rhel8/openstack\\-nova\\-libvirt:17\\.1\\.2/director\\-test3\\.ctlplane\\.sdc\\.subdomain\\.example\\.com:8787/rhosp\\-rhel9/openstack\\-nova\\-libvirt:17\\.1/' /var/lib/container-config-scripts/virtlogd_wrapper\n", "delta": "0:00:00.004390", "end": "2024-05-21 15:03:27.345631", "msg": "non-zero return code", "rc": 1, "start": "2024-05-21 15:03:27.341241", "stderr": "sed: -e expression #1, char 37: unknown option to `s'", "stderr_lines": ["sed: -e expression #1, char 37: unknown option to `s'"], "stdout": "", "stdout_lines": []}


Version-Release number of selected component (if applicable):
RHOSP 17.1.2

How reproducible:
Run "openstack overcloud upgrade run --yes --stack overcloud --tags system_upgrade ..." command while using NovaLibvirtLegacy service.


Actual results:
Operation fails because regex_escape() fails to process URL properly and make it usable for sed.

Expected results:
sed command is able to replace URLs properly

Comment 3 Lukas Bezdicka 2024-07-17 13:40:36 UTC
*** Bug 2295411 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2024-11-21 09:31:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (RHOSP 17.1.4 bug fix and enhancement advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2024:9973