Class: Pec::Command::Up
Class Method Summary collapse
Methods inherited from Base
after_do, before_do, not_fetch, print_exception, run
Class Method Details
.task(server, config) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |