digitalocean / droplet_kit

DropletKit is the official DigitalOcean API client for Ruby.
MIT License
514 stars 152 forks source link

Unexpected return of Droplet.create #90

Open krtschmr opened 8 years ago

krtschmr commented 8 years ago

According to Documentation

created = client.droplets.create(droplet)
# => DropletKit::Droplet(id: 1231, name: 'something.com', ...)

actuall i get only a temp object

<DropletKit::Droplet {:@name=>"PROXY", :@region=><DropletKit::Region {:@slug=>"nyc2", :@name=>"New York 2", :@sizes=>["1gb", "2gb", "4gb", "8gb", "32gb", "64gb", "512mb", "48gb", "16gb"], :@available=>true, :@features=>["private_networking", "backups", "ipv6", "metadata"]}>, :@image=><DropletKit::Image {:@id=>17150032, :@name=>"proxy", :@distribution=>"Ubuntu", :@slug=>nil, :@public=>false, :@regions=>["nyc2"], :@type=>"snapshot"}>, :@size=>"512mb", :@ssh_keys=>[1264198], :@id=>14676199, :@memory=>512, :@vcpus=>1, :@disk=>20, :@locked=>true, :@created_at=>"2016-05-04T16:46:35Z", :@status=>"new", :@backup_ids=>[], :@snapshot_ids=>[], :@action_ids=>nil, :@features=>["virtio"], :@networks=>#<struct DropletKit::NetworkHash v4=[], v6=[]>, :@kernel=>nil, :@size_slug=>"512mb", :@tags=>[], :@names=>nil, :@backups=>nil, :@ipv6=>nil, :@user_data=>nil, :@private_networking=>nil}

that means i have no id nor IP

CloudCowboyCo commented 8 years ago

Hey Tim, client = DropletKit::Client.new(access_token: token) droplet = DropletKit::Droplet.new(name: config[:name], region: config[:region], size: config[:size], image: config[:image], user_data: config[:user_data], ssh_keys: config[:ssh_keys].to_s.split, private_networking: config[:private_networking]) create = client.droplets.create(droplet) while client.droplets.find(id: create.id.to_s).status != 'active' do print "." end

I pull the ID from the create var with the create.id.to_s config if a hash of the settings I want for the system. Let me know if this helps.

Joshua