Class: HammerCLIKatello::ContentView::InfoCommand

Inherits:
InfoCommand
  • Object
show all
Includes:
OrganizationOptions
Defined in:
lib/hammer_cli_katello/content_view.rb

Instance Method Summary collapse

Methods included from OrganizationOptions

included, #org_options

Methods included from ResolverCommons

included

Instance Method Details

#extend_data(data) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/hammer_cli_katello/content_view.rb', line 116

def extend_data(data)
  %w(yum docker ostree file deb ansible_collection python).each do |content_type|
    data["_#{content_type}_repositories"] = data["repositories"].select do |repo|
      repo["content_type"] == content_type
    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