class Pec::Command::Up
Public Class Methods
task(server, config)
click to toggle source
# File lib/pec/command/up.rb, line 3 def self.task(server, config) case when server.nil? Pec::Logger.info "make start #{config.name}" attribute = {name: config.name} begin attribute = build(config, attribute) attribute = post_build(config, attribute) Yao::Server.create(attribute) Pec::Logger.info "create success! #{config.name}" rescue => e Pec::Logger.critical(e) Pec::Logger.warning "recovery start #{config.name}" attribute.deep_merge!(e.attribute) if e.is_a?(Pec::PortError) && e.attribute Pec.processor_matching(config, Pec::Handler) do |klass| klass.recover(attribute) end Pec::Logger.warning "recovery success! #{config.name}" end when server.status == "SHUTOFF" Yao::Server.start(server.id) Pec::Logger.info "start server: #{config.name}" else Pec::Logger.notice "already server: #{config.name}" end end