Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Created April 1, 2022 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsherrill/7e1109953fa9cd5ca71aea53ba77d08c to your computer and use it in GitHub Desktop.
Save jlsherrill/7e1109953fa9cd5ca71aea53ba77d08c to your computer and use it in GitHub Desktop.
Katello::ContentView.non_default.each do |cv|
Katello::Repository.in_default_view.each do |library_instance|
cv.versions.with_library_repo(library_instance).each do |version|
if version.archived_repos.find_by(:library_instance_id => library_instance.id).nil?
found = version.repositories.find_by(:library_instance_id => library_instance.id)
puts "#{cv.name} #{version.version}: #{library_instance.name} : env repo: #{found.id} in #{found.environment&.name}"
end
end
end
end ; nil
@jlsherrill
Copy link
Author

jlsherrill commented Apr 1, 2022

example output: Export-Library-myfoo 2.0: test : env repo: 3 in Library

manually deleting the 'env repo' (id = 3 here), may resolve the issue

@sayan3296
Copy link

sayan3296 commented Apr 7, 2022

It worked like charm

RHEL6 24.0: Red Hat Enterprise Linux 6 Server RPMs x86_64 6.10 : env repo: 48 in Library

This means, we have to take care of version 24.0 of RHEL6 CV.

So, in this scenario:

--> Re-synced Red Hat Enterprise Linux 6 Server RPMs x86_64 6.10 repo properly.

--> Republished a new version of RHEL6 CV and promote it to all environments.

--> Deleted version 24.0 of RHEL6 CV entirely

Re-executed the same rake script and no output this time . So processed with content migration and that issue never appeared again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment