Bug 1683935

Summary: Unable to create docker repository when "Registry Name Pattern" is set in LE
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: Container ManagementAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: egolov, jsherril
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0.30-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:40:17 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 Ranjan Kumar 2019-02-28 07:14:28 UTC
Description of problem: Unable to create docker type repository


Steps to reproduce:
1. Content -> Lifecycle Environment
2. Select environment other than "Library" (create one if necessary)
3. In registry pattern name field, put the pattern with content_view.version and save the 'Registry Name Pattern'
4. Now try to create a repository of type docker

==> /var/log/foreman/production.log <==
2019-02-28T12:24:16 [I|app|] Started PUT "/katello/api/v2/environments/1?organization_id=1" for 10.76.1.165 at 2019-02-28 12:24:16 +0530
2019-02-28T12:24:16 [I|app|33a520d0] Processing by Katello::Api::V2::EnvironmentsController#update as JSON
2019-02-28T12:24:16 [I|app|33a520d0]   Parameters: {"library"=>true, "registry_name_pattern"=>"<%=content_view.version%>", "registry_unauthenticated_pull"=>true, "id"=>"1", "name"=>"Library", "label"=>"Library", "description"=>nil, "organization_id"=>"1", "organization"=>{"name"=>"RedHat", "label"=>"RedHat", "id"=>1}, "created_at"=>"2019-02-11 15:54:15 +0530", "updated_at"=>"2019-02-28 12:21:35 +0530", "prior"=>nil, "successor"=>nil, "counts"=>{"content_hosts"=>2, "content_views"=>3, "packages"=>35112, "puppet_modules"=>13, "module_streams"=>0, "errata"=>{"security"=>785, "bugfix"=>2553, "enhancement"=>750, "total"=>4088}, "yum_repositories"=>8, "docker_repositories"=>1, "ostree_repositories"=>0, "products"=>8}, "permissions"=>{"create_lifecycle_environments"=>true, "view_lifecycle_environments"=>true, "edit_lifecycle_environments"=>true, "destroy_lifecycle_environments"=>false, "promote_or_remove_content_views_to_environments"=>true}, "api_version"=>"v2", "environment"=>{"id"=>"1", "name"=>"Library", "description"=>nil, "library"=>true, "organization_id"=>"1", "created_at"=>"2019-02-11 15:54:15 +0530", "updated_at"=>"2019-02-28 12:21:35 +0530", "label"=>"Library", "registry_name_pattern"=>"<%=content_view.version%>", "registry_unauthenticated_pull"=>true, "prior"=>nil}}
2019-02-28T12:24:16 [I|app|33a520d0] Current user set to admin (admin)
2019-02-28T12:24:17 [E|app|33a520d0] Safemode::NoMethodError: undefined method '#version' for Katello::ContentView::Jail (Katello::ContentView)
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode/jail.rb:22:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:52:in `bind'
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.23/app/models/katello/repository.rb:681:in `safe_render_container_name'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.23/app/lib/katello/validators/environment_docker_repositories_validator.rb:25:in `block in validate_repositories'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb:41:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.23/app/lib/katello/validators/environment_docker_repositories_validator.rb:24:in `validate_repositories'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.23/app/lib/katello/validators/environment_docker_repositories_validator.rb:12:in `validate'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda'



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


How reproducible: Always

Comment 4 Justin Sherrill 2019-03-11 16:42:05 UTC
Created redmine issue https://projects.theforeman.org/issues/26304 from this bug

Comment 5 Justin Sherrill 2019-03-11 17:54:47 UTC
The documentation around this feature says you can use 'content_view.version', however this doesnt' make any sense as content_views don't have versions.  It should say 'content_view_version.version', however this does not work.  I have opened up an upstream Pr to resolve this.  

In addition, this is the same problem as https://bugzilla.redhat.com/show_bug.cgi?id=1683936, so i am going to close as a dup.

Comment 6 Justin Sherrill 2019-03-11 17:54:59 UTC
*** Bug 1683936 has been marked as a duplicate of this bug. ***

Comment 7 Bryan Kearney 2019-03-15 20:03:19 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26304 has been resolved.

Comment 9 Mirek Długosz 2019-03-28 13:00:33 UTC
Context help by registry name pattern doesn't mention "content_view.version" - "content_view_version.version" is listed instead.

I have set up registry name pattern to every field listed in help in sequence, and each time verified that change is visible and affects container URLs. So we should have pretty good confidence that fields that we document really can be used.



Version:
Satellite 6.5 snap 21
pulp-server-2.18.1.1-1.el7sat.noarch
foreman-1.20.1.29-1.el7sat.noarch
tfm-rubygem-katello-3.10.0.33-2.el7sat.noarch
satellite-6.5.0-10.el7sat.noarch

Comment 12 errata-xmlrpc 2019-05-14 12:40:17 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