Class: Pec::Command::Destroy
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 |
# File 'lib/pec/command/destroy.rb', line 3 def self.task(server, config) unless server Pec::Logger.notice "not be created #{config.name}" else if Pec.[:force] || Thor.new.yes?("#{config.name}: Are you sure you want to destroy the '#{config.name}' VM? [y/N]") ports = Yao::Port.list({ device_id: server.id }) ports.each do |port| Yao::Port.destroy(port.id) Pec::Logger.notice "port delete id:#{port.id}" end if ports Yao::Server.destroy(server.id) Pec::Logger.info "#{config.name} is deleted!" end end end |