Sha256: 5df59ae0f4b9fad1cfb51ca8452a54d0b58994190c8d6857c5ed3f1027597887
Contents?: true
Size: 851 Bytes
Versions: 4
Compression:
Stored size: 851 Bytes
Contents
module RabbitMQ::Definition class Drop < Command def execute if !FileDefinition.exists? Logger.error "No definition with vhosts exists" else if !agree("This will delete vhosts (#{vhost_names.join(',')}), continue? y/n".yellow) Logger.error "Aborted by user" else delete_vhosts Logger.progress "Removing definition..." definition.destroy Logger.success "Done" end end end private def definition @definition ||= FileDefinition.read end def vhost_names @vhost_names ||= definition.vhosts.map { |vhost| vhost['name'] } end def delete_vhosts vhost_names.each do |vhost| Logger.progress "Deleting vhost '#{vhost}'..." if verbose client.delete_vhost(vhost) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems