Module: HammerCLIKatello::QueryOrganizationOptions

Defined in:
lib/hammer_cli_katello/hostgroup_extensions.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hammer_cli_katello/hostgroup_extensions.rb', line 5

def self.included(base)
  base.option_family do
    parent '--query-organization-id', 'ORGANIZATION_ID',
           _('Organization ID to search by'),
           attribute_name: :option_organization_id
    child '--query-organization', 'ORGANIZATION_NAME',
          _('Organization name to search by'),
          attribute_name: :option_organization_name
    child '--query-organization-label', 'ORGANIZATION_LABEL',
          _('Organization label to search by'),
          attribute_name: :option_organization_label
  end

  base.validate_options :before, 'IdResolution' do
    organization_options = [
      :option_organization_id, :option_organization_name, :option_organization_label
    ]

    if option(:option_lifecycle_environment_name).exist? ||
       option(:option_content_view_name).exist?
      any(*organization_options).required
    end
  end
end