Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37232 - Added extra info for CV & repos #931

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, didn't know you could assign a variable and do a ternary operator on the same line. Learned something new today 🤯

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