Sha256: eff84b61a442a1bb2b7f1aec116b9c351642c6f0c14a886fa31b1a50e878a50a

Contents?: true

Size: 734 Bytes

Versions: 7

Compression:

Stored size: 734 Bytes

Contents

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

  c.action do |global_options,options,args|

    if args.empty?
      raise "You must specify the cloud ips you want to unmap"
    end

    ips = CloudIP.find_or_call(args) do |id|
      raise "Couldn't find cloud ip #{id}"
    end

    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

7 entries across 7 versions & 1 rubygems

Version Path
bbcloud-0.11.2 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.11.1 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.11.0 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.10.1 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.9.2 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.9.1 lib/bbcloud/commands/cloudips-unmap.rb
bbcloud-0.9 lib/bbcloud/commands/cloudips-unmap.rb