Class: Crowbar::Client::App::Services

Inherits:
Base
  • Object
show all
Defined in:
lib/crowbar/client/app/services.rb

Overview

A Thor based CLI wrapper for Services commands

Instance Method Summary collapse

Methods inherited from Base

banner, handle_argument_error, #initialize

Constructor Details

This class inherits a constructor from Crowbar::Client::App::Base

Instance Method Details

#clear_restart(node, cookbook = nil, service = nil) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/crowbar/client/app/services.rb', line 45

def clear_restart(node, cookbook = nil, service = nil)
  Command::Services::ClearServiceRestart.new(
    *command_params(
      node: node,
      cookbook: cookbook,
      service: service
    )
  ).execute
rescue => e
  catch_errors(e)
end

#disable_restart(cookbook, value) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/crowbar/client/app/services.rb', line 68

def disable_restart(cookbook, value)
  unless ["true", "false"].include? value.downcase
    msg = "#{value} is not a valid value for this command. Please use true or false"
    raise SimpleCatchableError(msg)
  end
  value = value.casecmp("true").zero? ? true : false
  Command::Services::SetRestartFlag.new(
    *command_params(
      cookbook: cookbook,
      disallow_restart: value
    )
  ).execute
rescue => e
  catch_errors(e)
end

#list_restartsObject



32
33
34
35
36
# File 'lib/crowbar/client/app/services.rb', line 32

def list_restarts
  Command::Services::ListServiceRestarts.new(*command_params).execute
rescue => e
  catch_errors(e)
end

#restart_flagsObject



60
61
62
63
64
# File 'lib/crowbar/client/app/services.rb', line 60

def restart_flags
  Command::Services::ListRestartFlags.new(*command_params).execute
rescue => e
  catch_errors(e)
end