Skip to content

Commit

Permalink
Fixes #37232 - Added extra info for CV & repos
Browse files Browse the repository at this point in the history
  • Loading branch information
parthaa committed Mar 8, 2024
1 parent 19ea6f3 commit 44681bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/hammer_cli_katello/content_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ class InfoCommand < HammerCLIKatello::InfoCommand
field :published, _("Published"), Fields::Date
end

collection :components, _("Components"), hide_blank: true, hide_empty: true do
collection :cv_components, _("Components"), hide_blank: true, hide_empty: true do
field :id, _("Id")
field :name, _("Name")
field :latest, _("Latest version"), Fields::Boolean
field :unpublished, _("Not yet published"), Fields::Boolean
field :always_latest, _("Always update to the latest"), Fields::Boolean
end

collection :activation_keys, _("Activation Keys"), hide_blank: true, hide_empty: true do
Expand All @@ -117,6 +120,18 @@ def extend_data(data)
end
end

if data["composite"]
data["cv_components"] = data["content_view_components"]&.map do |component|
cv_latest = component.dig("content_view", "latest_version")
{
"id" => component.dig("content_view_version", "id"),
"name" => component.dig("content_view_version", "name") || component.dig("content_view", "name"),
"always_latest" => component["latest"],
"latest" => cv_latest == component.dig("content_view_version", "version"),
"unpublished" => component["content_view_version"].nil?
}
end
end
data
end

Expand Down
14 changes: 14 additions & 0 deletions lib/hammer_cli_katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class InfoCommand < HammerCLIKatello::InfoCommand
Fields::Field, :hide_blank => true
field :ignorable_content, _("Ignorable Content Units"), Fields::List, :hide_blank => true

label _("Publish Settings") do
field :restrict_to_arch, _("Restrict to architecture")
field :restrict_to_os_versions, _("Restrict to OS Version")
end

label _("HTTP Proxy") do
from :http_proxy do
field :id, _("Id"), Fields::Field, :hide_blank => true
Expand Down Expand Up @@ -156,13 +161,22 @@ def extend_data(data)
data["gpg_key_name"] = data["gpg_key"]["name"]
end

setup_arch_and_os(data)
setup_sync_state(data)
setup_booleans(data)
setup_mirroring_policy(data)
setup_content_counts(data) if data["content_counts"]
data
end

def setup_arch_and_os(data)
arch = data["arch"]
data["restrict_to_arch"] = arch == 'noarch' ? _('No restriction') : arch
os_versions = data["os_versions"] || []
data["restrict_to_os_versions"] = _('No restriction')
data["restrict_to_os_versions"] = os_versions.join(", ") unless os_versions.empty?
end

def setup_booleans(data)
data["_redhat_repo"] = data.dig("product", "redhat") ? _("yes") : _("no")
data["_publish_via_http"] = data["unprotected"] ? _("yes") : _("no")
Expand Down

0 comments on commit 44681bb

Please sign in to comment.