ey-core 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -130,6 +130,9 @@ class Ey::Core::Client::Environment < Ey::Core::Model
130
130
  "blueprint_id" => options["blueprint_id"]
131
131
  }
132
132
  }
133
+ if ip_id = options["ip_id"]
134
+ params["cluster_configuration"]["ip_id"] = ip_id
135
+ end
133
136
 
134
137
  self.connection.requests.new(self.connection.boot_environment(params.merge("id" => self.id)).body["request"])
135
138
  else
@@ -33,8 +33,15 @@ class Ey::Core::Client
33
33
  when "utils" then "util"
34
34
  end
35
35
  blueprint_data.each_with_index do |server_data,index|
36
- role = "app_master" if type == 'app_instances' && index == 0
37
- server = server_hash(role: role, environment: environment, flavor: server_data["flavor"]["id"], name: server_data["name"])
36
+ role_to_use = (type == 'app_instances' && index == 0) ? "app_master" : role
37
+ server = server_hash(role: role_to_use, environment: environment, flavor: server_data["flavor"]["id"], name: server_data["name"])
38
+ if role_to_use == "app_master"
39
+ if ip_id = params["cluster_configuration"]["ip_id"]
40
+ if find(:addresses, ip_id)
41
+ server[:address] = url_for("/addresses/#{ip_id}")
42
+ end
43
+ end
44
+ end
38
45
  create_volume(server: server, size: server_data["volume_size"], iops: server_data["volume_iops"])
39
46
  servers[server["id"]] = server
40
47
  end
@@ -1,5 +1,5 @@
1
1
  module Ey
2
2
  module Core
3
- VERSION = "3.1.3"
3
+ VERSION = "3.1.4"
4
4
  end
5
5
  end
@@ -30,5 +30,18 @@ describe 'as a user' do
30
30
  new_environment.boot("blueprint_id" => blueprint.id)
31
31
  }.to change { new_environment.servers.count }.to(5)
32
32
  end
33
+
34
+ it "boots an environment from a blueprint with an IP Address" do
35
+ address = client.addresses.create!(provider: provider, location: "us-west-2").resource!
36
+ new_environment = create_environment(account: account, app: app, environment: {name: SecureRandom.hex(5)}, boot: false)
37
+
38
+ expect {
39
+ new_environment.boot("blueprint_id" => blueprint.id, "ip_id" => address.id)
40
+ }.to change { new_environment.servers.count }.to(5)
41
+
42
+ app_master = new_environment.servers.detect{|s| s.role == "app_master"}
43
+ expect(app_master.address).to eq address
44
+ end
45
+
33
46
  end
34
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-09 00:00:00.000000000 Z
12
+ date: 2016-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable