Class: HammerCLIKatello::ContentViewComponentBase::ComponentCommand

Inherits:
SingleResourceCommand
  • Object
show all
Includes:
HammerCLIKatello::CompositeContentViewNameResolvable, OrganizationOptions
Defined in:
lib/hammer_cli_katello/content_view_component.rb

Instance Method Summary collapse

Methods included from HammerCLIKatello::CompositeContentViewNameResolvable

#composite_content_view_resolve_options, included, #options

Methods included from OrganizationOptions

included, #org_options

Methods included from ResolverCommons

included

Instance Method Details

#get_component_by_name_or_id(composite_content_view_id, options) ⇒ Object



14
15
16
17
18
# File 'lib/hammer_cli_katello/content_view_component.rb', line 14

def get_component_by_name_or_id(composite_content_view_id, options)
  get_components(composite_content_view_id).find do |cv|
    cv["content_view"]["name"] == options[:name] || cv["content_view"]["id"] == options[:id]
  end
end

#get_components(composite_content_view_id) ⇒ Object



7
8
9
10
11
12
# File 'lib/hammer_cli_katello/content_view_component.rb', line 7

def get_components(composite_content_view_id)
  component_options = {:composite_content_view_id => composite_content_view_id}
  components = ::HammerCLIForeman.foreman_resource(:content_view_components).call(:index,
                                                   component_options)
  components["results"] || []
end