DockerMetaTags are not getting deleted when docker tags are. Deletion of docker tags only results in the nullification. What we need to happen is some thing along if dockerTag.deleted? check if schema1 meta tag does Not have a schema2 entry and if so delete it. check if schema2 meta tag does Not have a schema1 entry and if so delete it. end To see a good example try the following in a rails or foreman-rake console <pre> >> dmt = ::Katello::DockerMetaTag.first >> dmt.schema1.try(:destroy) ; dmt.schema2.try(:destroy) >> dmt = ::Katello::DockerMetaTag.find(dmt.id) # reload #Actual <Katello::DockerMetaTag id: 4978, schema1_id: 5753, schema2_id: nil, name: "1.24.2-glibc", repository_id: 3> #Expected #ActiveRecord::RecordNotFound: Couldn't find Katello::DockerMetaTag with 'id'=4978 #This operation should fail because deleting the associated docker tags should wipe out the meta tag </pre>
Created from redmine issue http://projects.theforeman.org/issues/21326
Upstream bug assigned to paji
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21326 has been resolved.
VERIFIED Version Tested: Satellite-6.3 Snap 28 irb(main):022:0> dmt = ::Katello::DockerMetaTag.first => #<Katello::DockerMetaTag id: 2, schema1_id: 2, schema2_id: 119, name: "1.26.2-glibc", repository_id: 36> irb(main):023:0> dmt.schema1.try(:destroy) ; dmt.schema2.try(:destroy) => #<Katello::DockerTag id: 119, name: "1.26.2-glibc", repository_id: 36, created_at: "2017-12-11 08:16:43", updated_at: "2017-12-11 08:16:43", uuid: "e6a5dea0-cd5f-4250-8a19-5e9f17ff7aa6", docker_manifest_id: 13> irb(main):024:0> dmt = ::Katello::DockerMetaTag.find(dmt.id) ActiveRecord::RecordNotFound: Couldn't find Katello::DockerMetaTag with 'id'=2 from /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/core.rb:155:in `find' from (irb):24 from /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start' from /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start' from /usr/share/foreman/lib/tasks/console.rake:8:in `block in <top (required)>' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' from /opt/rh/rh-ruby23/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run' from /opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/bin/rake:33:in `<top (required)>' from /opt/rh/rh-ruby23/root/usr/bin/rake:23:in `load' from /opt/rh/rh-ruby23/root/usr/bin/rake:23:in `<main>' Found expected results. Could not find DockerMetaTags as associated docker tag deleted.
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-2018:0336