Created
February 4, 2021 00:38
-
-
Save jlsherrill/4e4b57a2a45ff2231c1619b638fc06ce to your computer and use it in GitHub Desktop.
extract repo certs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org = Organization.find(1) | |
path = Dir.mktmpdir("pulp-certs") | |
Katello::Repository.yum_type.in_default_view.in_organization(org).each do |repo| | |
filename = File.join(path, "#{repo.product.label}-#{repo.label}") | |
importer = repo.pulp_repo_facts['importers'].find{|i| i['id'] == 'yum_importer'} | |
if importer && importer['config']['ssl_client_cert'] | |
combined = importer['config']['ssl_client_cert'] + importer['config']['ssl_client_key'] | |
File.open(filename, 'w'){|file| file.write(combined) } | |
puts "Wrote #{filename}" | |
end | |
end | |
puts "All repo certs written to #{path}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment