Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Created February 4, 2021 00:38
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/4e4b57a2a45ff2231c1619b638fc06ce to your computer and use it in GitHub Desktop.
Save jlsherrill/4e4b57a2a45ff2231c1619b638fc06ce to your computer and use it in GitHub Desktop.
extract repo certs
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