Bug 1648358

Summary: [Container Admin] Failed promotion of CV with containers - error message is unhelpful
Product: Red Hat Satellite Reporter: Mirek Długosz <mzalewsk>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: bkearney, egolov, ehelms, jsherril, mzalewsk
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0,tfm-rubygem-katello-3.10.0.14-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:38:41 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-09 14:21:49 UTC
There are two main reasons why we reject promotion of CV with containers - at least one of repository name will turn out to be invalid (empty, too long, with invalid characters) or few repositories will get the same name on new LE (pattern is not unique enough). Katello app/lib/katello/validators/environment_docker_repositories_validator.rb does good job at distinguishing these two scenarios and returning helpful error message.

However, app/models/katello/content_view.rb:check_docker_repository_names! will swallow these helpful messages and return generic "Content View publish to environment $FOO will result in invalid container image name of member repositories".

Could we present error message returned from environment_docker_repositories_validator to user? This would really help in figuring out where the root cause of the problem is and what corrective steps should be taken.


Steps to Reproduce:
1. Add new Lifecycle environment
2. Prepare docker product with at least two repositories
3. Create CV with product from earlier step
4. Set up LE Registry Name Patter to something not unique enough (like `<%= organization.label %>`)
5. Try to promote CV to LE


Actual results:
Unhelpful generic error message appears


Expected results:
Helpful error message about registry names not unique enough appears

Comment 3 Justin Sherrill 2018-11-26 19:52:04 UTC
Mirosław, would this sound better: 

Validation failed: Container repository name for repository 'docker' is not unique and cannot be created in 'Library'. Its Container Repository Name (busybox) conflicts with an existing repository. Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific.

Comment 4 Justin Sherrill 2018-11-26 19:53:10 UTC
Created redmine issue https://projects.theforeman.org/issues/25558 from this bug

Comment 5 Mirek Długosz 2018-11-27 10:48:47 UTC
Justin,

yes, I think it's improvement.

But will we display that message every time when CV with docker repos promotion fails? I think promotion will usually fail due to registry name pattern not being specific enough, but may fail when published repository path is too long (over 255 characters) or contains invalid characters (not sure if possible to trigger, except for Bug 1646603). If we display this message when repository is rejected due to length, we are misleading users.

Comment 6 Justin Sherrill 2018-11-27 13:55:15 UTC
No, this message should only pop up when a non-unique registry name issue is encountered.  The invalid name will declare that it is invalid.

Comment 7 Mirek Długosz 2018-11-27 14:12:32 UTC
OK, that sounds good for me.

Comment 9 Satellite Program 2018-12-06 21:09:50 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25558 has been resolved.

Comment 10 Mirek Długosz 2019-01-04 17:30:28 UTC
Justin,

as we talked on IRC, when following steps to reproduce from original report, I still get generic error message.

I tested your proposed fix (https://github.com/Katello/katello/pull/7910) on my Satellite and this one will fix the issue.
Assigning it back to you, so this bugzilla can move back to ONQA once PR is included in Satellite snap.

Comment 11 Brad Buckingham 2019-01-23 18:42:11 UTC
The second issue tracker 25782 has been closed as the PR has been merged.  Moving BZ to POST.

Comment 13 Mirek Długosz 2019-01-28 12:45:56 UTC
Re-tested after patch has been included in downstream Satellite build.
Error messages on both Lifecycle Environment and Content View pages point to registry name pattern as root cause of issue.

On Lifecycle Environment page error message is: "An error occurred saving the Environment: Registry name pattern results in duplicate container image names for these repositories: alpine, busybox."
On Content View page error message is: "Registry name pattern results in duplicate container image names for these repositories: alpine, busybox. Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific."


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
pulp-server-2.18.0-0.1.rc.el7sat.noarch

Comment 16 errata-xmlrpc 2019-05-14 12:38:41 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