Module: HammerCLIKatello::LifecycleEnvironmentCommand::PriorIdResolvable

Included in:
CreateCommand
Defined in:
lib/hammer_cli_katello/lifecycle_environment.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/hammer_cli_katello/lifecycle_environment.rb', line 6

def self.included(base)
  base.option(
    "--prior",
    "PRIOR",
    _("Name of the prior environment")
  )
  base.validate_options :before, 'IdResolution' do
    any(:option_prior, :option_prior_id).required
  end
end

Instance Method Details

#request_paramsObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hammer_cli_katello/lifecycle_environment.rb', line 17

def request_params
  params = super
  prior = option_prior
  if prior
    params["prior_id"] = resolver.lifecycle_environment_id(
      HammerCLI.option_accessor_name("name") => prior,
      HammerCLI.option_accessor_name("organization_id") => params["organization_id"]
    )
  end
  params
end