Method: Bitferry::Volume.delete

Defined in:
lib/bitferry.rb

.delete(*tags, wipe: false) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/bitferry.rb', line 293

def self.delete(*tags, wipe: false)
  process = []
  tags.each do |tag|
    case (volumes = Volume.lookup(tag)).size
      when 0 then log.warn("no volumes matching (partial) tag #{tag}")
      when 1 then process += volumes
      else
        tags = volumes.collect { |v| v.tag }.join(', ')
        raise ArgumentError, "multiple volumes matching (partial) tag #{tag}: #{tags}"
    end
  end
  process.each { |volume| volume.delete(wipe: wipe) }
end