Sha256: f908959b2e15e1b0a7d36e91178cf35e7fb08020e43388b0793d1c1e507ae73d
Contents?: true
Size: 1.45 KB
Versions: 9
Compression:
Stored size: 1.45 KB
Contents
module ManageIQ module ApplianceConsole class EvmServer class NotRunnableError < RuntimeError; end class << self def running? service.running? end def start!(enable: false) raise NotRunnableError, "Cannot start #{I18n.t("product.name")}: #{not_runnable_reason}" unless runnable? service.start(enable) end 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 def stop service.stop end def restart service.restart end def enable service.enable end def disable service.disable end def runnable? DatabaseConfiguration.database_yml_configured? && MessageConfiguration.configured? end 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 private def service @service ||= LinuxAdmin::Service.new("evmserverd") end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems