Bug 1646603

Summary: [Container Admin] Registry Name Pattern with repository.url will always be rejected
Product: Red Hat Satellite Reporter: Mirek Długosz <mzalewsk>
Component: Container Management - ContentAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: bkearney, egolov
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0.10-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:38:40 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 Mirek Długosz 2018-11-05 18:19:01 UTC
Registry Name Pattern claims to allow repository.url variable, but it always reject it. If that variable is used, error message will be displayed: "An error occurred saving the Environment: Registry name pattern will result in invalid container image name of member repositories".


The problem is that name created by pattern must pass through ContainerImageNameValidator.validate_name function. It checks name against following regexp:
/\A([a-z0-9]+[a-z0-9\-\_\.]*)+(\/[a-z0-9]+[a-z0-9\-\_\.]*)*\z/

This regexp allows multiple slashes in name, but not subsequently (/ is OK, // is not). URL will contain :// (colon slash slash) sequence between protocol and host name. So URL technically can be used, but it will be rejected as invalid.



Version:
Satellite 6.5 snap 2
katello-3.9.0-0.11.rc2.el7sat.noarch
satellite-6.5.0-3.beta.el7sat.noarch
foreman-1.20.0-0.17.RC2.el7sat.noarch


Steps to reproduce:
1. Content -> Lifecycle Environment
2. Select environment other than "Library" (create one if necessary)
3. In registry pattern name field, put pattern with repository.url variable (example: "<%= organization.label %>/<%= repository.url %>/<%= repository.docker_upstream_name %>")
4. Save

Comment 4 Andrew Kofink 2019-01-04 15:16:23 UTC
Created redmine issue https://projects.theforeman.org/issues/25781 from this bug

Comment 5 Bryan Kearney 2019-01-07 21:15:08 UTC
Upstream bug assigned to akofink

Comment 6 Bryan Kearney 2019-01-08 21:17:01 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25781 has been resolved.

Comment 8 Mirek Długosz 2019-01-28 10:56:29 UTC
Fix confirmed after re-test.
There is no mention of "repository.url" in contextual help on Lifecycle Environment page.
Using registry name pattern from initial report above, on saving I get error message: "An error occurred saving the Environment: Registry name pattern will result in invalid container image name of member repositories"


Tested on:
Satellite 6.5 snap 13
foreman-1.20.1.9-1.el7sat.noarch
satellite-6.5.0-6.beta.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch
tfm-rubygem-katello-3.10.0.15-1.el7sat.noarch
pulp-server-2.18.0-0.1.rc.el7sat.noarch

Comment 11 errata-xmlrpc 2019-05-14 12:38:40 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, 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-2019:1222