Class: HammerCLIForemanTasks::RecurringLogic::DeleteCommand

Inherits:
HammerCLIForeman::DeleteCommand
  • Object
show all
Defined in:
lib/hammer_cli_foreman_tasks/recurring_logic.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



58
59
60
61
62
63
64
65
66
67
# File 'lib/hammer_cli_foreman_tasks/recurring_logic.rb', line 58

def execute
  response = send_request
  if response.length > 0
    puts _('The following recurring logics deleted:') + "\n"
    print_data(response)
  else
    puts _("No recurring logics deleted.")
  end
  HammerCLI::EX_OK
end

#request_paramsObject

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
# File 'lib/hammer_cli_foreman_tasks/recurring_logic.rb', line 43

def request_params
  params = super
  raise ArgumentError, "Please specify if you want to remove cancelled or finished recurring logics using --cancelled or --finished." unless (options['option_cancelled'] || options["option_finished"])
  raise ArgumentError, "Please only use one of the arguments at a time." if (options['option_cancelled'] && options["option_finished"])
  cancelled = "state=cancelled" if options["option_cancelled"]
  finished = "state=finished" if options["option_finished"]
  params["search"] = cancelled || finished
  params
end