Skip to content

Commit

Permalink
Fixes #38038 - Show full GPG Key URL
Browse files Browse the repository at this point in the history
In case you want to manually configure repositories provided by Katello
and use GPG keys for them, its helpful to have the full GPG key URL on
the repositories details page so that you can copy/paste it.
  • Loading branch information
sbernhard committed Nov 22, 2024
1 parent cc713d3 commit 395b7fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ def yum_gpg_key_url
end
end

def full_gpg_key_path(smart_proxy = nil, force_http = false)
return unless self.root.gpg_key.try(:content).present?

Check failure on line 361 in app/models/katello/repository.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Rails/Blank: Use `if self.root.gpg_key.try(:content).blank?` instead of `unless self.root.gpg_key.try(:content).present?`.
pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : ::SmartProxy.pulp_primary.url)
scheme = force_http ? 'http' : 'https'
"#{scheme}://#{pulp_uri.host.downcase}#{gpg_key_content_api_repository_url(self, :only_path => true)}"
end

def product_type
redhat? ? "redhat" : "custom"
end
Expand Down
1 change: 1 addition & 0 deletions app/views/katello/api/v2/repositories/base.json.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends 'katello/api/v2/common/identifier'

attributes :pulp_id => :backend_identifier
attributes :relative_path, :container_repository_name, :full_path, :library_instance_id
attributes :full_gpg_key_path
attributes :version_href, :remote_href, :publication_href
attributes :content_counts
attributes :mirroring_policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ <h4 translate>Sync Settings</h4>
on-save="save(repository)">
</dd>
</span>
<span ng-if="((repository.content_type === 'yum' && !product.redhat) || repository.content_type === 'deb') && repository.full_gpg_key_path ">
<dt translate>URL to GPG Key</dt>
<dd>
<a ng-href="{{ repository.full_gpg_key_path }}">{{ repository.full_gpg_key_path }}</a>
</dd>
</span>
<dt translate>SSL CA Cert</dt>
<dd bst-edit-select="repository.ssl_ca_cert.name"
readonly="product.redhat ||denied('edit_products', product) || !repository.allow_updates || repository.is_container_push"
Expand Down

0 comments on commit 395b7fd

Please sign in to comment.