Sha256: fb0203d0d6250e75317f1c5cb26a4f582bd47a23fad258301dc5e4778c0c0209
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
desc 'map Cloud IPs' arg_name 'cloudip-id server-id' command [:map] do |c| c.desc "Unmap mapped ips before remapping them" c.switch [:u, "unmap"] c.action do |global_options,options,args| if args.size > 2 raise "Too many arguments" end if args.size < 2 raise "You must specify the cloud ip id and the server id" end ip_id = args.first ip = CloudIP.find ip_id if ip.mapped? if options[:u] info "Unmapping ip #{ip}" ip.unmap 3.times do break unless ip.mapped? sleep 1 ip.reload end else raise "Refusing to map already mapped ip #{ip}" end end server_id = args.last server = Server.find server_id interface_id = server.interfaces.first["id"] info "Mapping #{ip} to interface #{interface_id} on #{server}" ip.map interface_id # Wait up to 3 seconds for mapping to complete 3.times do ip.reload break if ip.mapped? sleep 1 end render_table([ip], global_options) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bbcloud-0.9.2 | lib/bbcloud/commands/cloudips-map.rb |
bbcloud-0.9.1 | lib/bbcloud/commands/cloudips-map.rb |
bbcloud-0.9 | lib/bbcloud/commands/cloudips-map.rb |