Class: HammerCLIKatello::ContentViewComponent::RemoveComponents

Inherits:
HammerCLIKatello::ContentViewComponentBase::ComponentCommand show all
Defined in:
lib/hammer_cli_katello/content_view_component.rb

Instance Method Summary collapse

Methods inherited from HammerCLIKatello::ContentViewComponentBase::ComponentCommand

#get_component_by_name_or_id, #get_components

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

#component_content_view_idsObject



199
200
201
202
# File 'lib/hammer_cli_katello/content_view_component.rb', line 199

def component_content_view_ids
  return [] unless option_component_content_view_ids
  option_component_content_view_ids.split(",").map(&:strip)
end

#component_content_view_namesObject



194
195
196
197
# File 'lib/hammer_cli_katello/content_view_component.rb', line 194

def component_content_view_names
  return [] unless option_component_content_view_names
  option_component_content_view_names.split(",").map(&:strip)
end

#request_paramsObject



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/hammer_cli_katello/content_view_component.rb', line 204

def request_params
  super.tap do |opts|
    if option_component_content_view_names || option_component_content_view_ids
      component_cv_names = component_content_view_names
      component_cv_ids = component_content_view_ids
      component_ids = opts["component_ids"] || []
      components = get_components(opts["composite_content_view_id"])
      components.each do |comp|
        if component_cv_names.include?(comp["content_view"]["name"]) ||
           component_cv_ids.include?(comp["content_view"]["id"].to_s)
          component_ids << comp["id"]
        end
      end
      opts["component_ids"] = component_ids.uniq
    end
  end
end