Bug 2039059

Summary: Pulp3: Migration fails with error "Katello::Errors::Pulp3Error: Empty variable tag"
Product: Red Hat Satellite Reporter: wclark
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.7CC: dkliban, ggainey, osousa, pmendezh, vsedmik
Target Milestone: 6.9.9Keywords: Triaged, Upgrades
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulp-2to3-migration-0.11.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-20 20:34:53 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 wclark 2022-01-10 20:22:04 UTC
The condition to produce the bug is similar to https://bugzilla.redhat.com/show_bug.cgi?id=2020473 but this issue occurs during content migration rather than repository sync

To reproduce: Have some custom repository (ex. Fedora 35 synced from https://dl.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/ ) which contains an RPM that has files with '{{' or similar characters in file names. Then filelists.xml will be like:

In "6dc8dae1be904c2613d5aa3667dacd2554d05077eb1ce4296b6edfa3c4db3a46-filelists.xml.gz"
<package pkgid="f2056c2614a2e47efd63138cf9ad2fac9ea5ea193d736fc35069c1bf6723d549" name="R-rlang" arch="x86_64">
  <version epoch="0" ver="0.4.11" rel="3.fc35"/>
  <file type="dir">/usr/lib/.build-id</file>
  <file type="dir">/usr/lib/.build-id/42</file>
  <file>/usr/lib/.build-id/42/5049f5a9e0d1ac25c21de795f28fe886bfa0ca</file>
  <file type="dir">/usr/lib64/R/library/rlang</file>
  <file>/usr/lib64/R/library/rlang/DESCRIPTION</file>
  <file>/usr/lib64/R/library/rlang/INDEX</file>
  <file>/usr/lib64/R/library/rlang/LICENSE</file>
  <file type="dir">/usr/lib64/R/library/rlang/Meta</file>
  snip...
  <file>/usr/lib64/R/library/rlang/help/wref_key.html</file>
  <file>/usr/lib64/R/library/rlang/help/wref_value.html</file>
  <file>/usr/lib64/R/library/rlang/help/zap.html</file>
  <file>/usr/lib64/R/library/rlang/help/zap_srcref.html</file>
  <file>/usr/lib64/R/library/rlang/help/{{.html</file>   <================= TemplateSyntaxError: Empty variable tag on line 548\n",
  <file>/usr/lib64/R/library/rlang/help/{{}}.html</file> <=================

And cause the TemplateSyntaxError: Empty variable tag when the migration plugin calls `render_filelists`

Comment 2 Grant Gainey 2022-02-17 13:42:07 UTC
Fix backported to pulp-2to3-migration 0.11.9

Comment 3 Vladimír Sedmík 2022-03-28 15:25:02 UTC
Verified on 6.9.9 snap 1:

1) Synchronized Fedora 35 repo from https://dl.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/
(here I bumped into BZ#2020473 and had to apply its patch manually for successful sync)

2) Successfully migrated the content, no errors spotted.

[root@sat ~]# satellite-maintain prep-6.10-upgrade
Running Preparations for the Satellite 6.10 upgrade
================================================================================
Preparations for the Satellite 6.10 upgrade: 
prep-6.10-upgrade may take a while depending on the size of /var/lib/pulp/content
| # chgrp -R pulp /var/lib/pulp/content                               [OK]      
--------------------------------------------------------------------------------


[root@sat ~]# satellite-maintain content prepare
Running Prepare content for Pulp 3
================================================================================
...
2022-03-28 04:39:25 -0400: Importing migrated content type rpm: 65275/65732
2022-03-28 04:39:35 -0400: Importing migrated content type rpm: 65732/65732
Content Migration completed successfully
                                                                      [OK]
--------------------------------------------------------------------------------
...

[root@sat ~]# satellite-maintain content migration-stats
Running Retrieve Pulp 2 to Pulp 3 migration statistics
================================================================================
Retrieve Pulp 2 to Pulp 3 migration statistics: 
============Migration Summary================
Migrated/Total RPMs: 65732/65732
Migrated/Total errata: 0/0
Migrated/Total repositories: 1/1

Comment 8 errata-xmlrpc 2022-04-20 20:34:53 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 (Important: Satellite 6.9.9 Async Bug Fix Update), 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/RHSA-2022:1478