Class: ManageIQ::ApplianceConsole::EvmServer

Inherits:
Object
  • Object
show all
Defined in:
lib/manageiq/appliance_console/evm_server.rb

Defined Under Namespace

Classes: NotRunnableError

Class Method Summary collapse

Class Method Details

.disableObject



42
43
44
# File 'lib/manageiq/appliance_console/evm_server.rb', line 42

def disable
  service.disable
end

.enableObject



38
39
40
# File 'lib/manageiq/appliance_console/evm_server.rb', line 38

def enable
  service.enable
end

.not_runnable_reasonObject



50
51
52
53
54
55
56
# File 'lib/manageiq/appliance_console/evm_server.rb', line 50

def not_runnable_reason
  if !DatabaseConfiguration.database_yml_configured?
    "A Database connection has not been configured."
  elsif !MessageConfiguration.configured?
    "Messaging has not been configured."
  end
end

.restartObject



34
35
36
# File 'lib/manageiq/appliance_console/evm_server.rb', line 34

def restart
  service.restart
end

.runnable?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/manageiq/appliance_console/evm_server.rb', line 46

def runnable?
  DatabaseConfiguration.database_yml_configured? && MessageConfiguration.configured?
end

.running?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/manageiq/appliance_console/evm_server.rb', line 7

def running?
  service.running?
end

.start(enable: false) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/manageiq/appliance_console/evm_server.rb', line 17

def start(enable: false)
  start!(:enable => enable)
rescue AwesomeSpawn::CommandResultError => e
  say(e.result.output)
  say(e.result.error)
  say("")
  false
rescue NotRunnableError => e
  say(e.to_s)
  say("")
  false
end

.start!(enable: false) ⇒ Object

Raises:



11
12
13
14
15
# File 'lib/manageiq/appliance_console/evm_server.rb', line 11

def start!(enable: false)
  raise NotRunnableError, "Cannot start #{I18n.t("product.name")}: #{not_runnable_reason}" unless runnable?

  service.start(enable)
end

.stopObject



30
31
32
# File 'lib/manageiq/appliance_console/evm_server.rb', line 30

def stop
  service.stop
end