Sha256: 152682db74e8399d9501f3a6dc1a6fa011170a6b30b21fc6a535690d16d20d08

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

desc 'unmap Cloud IPs'
arg_name 'cloudip-id...'
command [:unmap] do |c|

  c.action do |global_options,options,args|

    raise "you must specify the cloud ip ids to unmap as arguments" if args.empty?

    ips = CloudIP.find args

    ips.compact!

    ips.each do |ip|
      if ip.mapped?
        info "Unmapping cloud ip #{ip}"
        ip.unmap
        ip.reload
      else
        warn "Cloud ip #{ip} already unmapped"
      end
    end

    # Wait up to 3 seconds for unmapping to complete
    3.times do
      break unless ips.find { |ip| ip.mapped? }
      sleep 1
      ips.each { |ip| ip.reload if ip.mapped? }
    end

    render_table(ips, global_options)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bbcloud-0.8.2 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.8.1 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.8 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.7 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.6.2 lib/bbcloud/commands/cloudips-unmap.rb