gaptool-server 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/routes/main.rb +18 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916d4e82528c729ee6340c99917251a702a2be4d
|
4
|
+
data.tar.gz: fe7c48d8ceb9f715473ecacf1c35c6ef0ef12486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a9925d8817c15b51ed2e65034a1abc665d3bad786bab797da818ec611202dc73c68d3103272b08f3fe2587b45d3d3f8969b44caa6616a67ed6f96d5a7920fd
|
7
|
+
data.tar.gz: 729bb7e534b3e4b9e9224756b8d6a950ef81507f20e3f81a08719f8f29b2fcc2f7d94a376ceba07248caa52961029e123ff80377ba541dc81ef46a44cbc481fb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.8
|
data/lib/routes/main.rb
CHANGED
@@ -21,6 +21,10 @@ class GaptoolServer < Sinatra::Application
|
|
21
21
|
security_group = data['security_group'] || $redis.hget("role:#{data['role']}", "security_group")
|
22
22
|
sgid = gt_securitygroup(data['role'], data['environment'], data['zone'], security_group)
|
23
23
|
image_id = data['ami'] || $redis.hget("amis:#{data['role']}", data['zone'].chop) || $redis.hget("amis", data['zone'].chop)
|
24
|
+
chef_runlist = $redis.hget("role:#{data['role']}", "chef_runlist")
|
25
|
+
unless data['chef_runlist'].nil?
|
26
|
+
chef_runlist = data['chef_runlist'].to_json
|
27
|
+
end
|
24
28
|
instance = @ec2.instances.create(
|
25
29
|
:image_id => image_id,
|
26
30
|
:availability_zone => data['zone'],
|
@@ -37,7 +41,8 @@ class GaptoolServer < Sinatra::Application
|
|
37
41
|
host_key = "instance:#{data['role']}:#{data['environment']}:#{@secret}"
|
38
42
|
$redis.hmset(host_key, 'instance_id', instance.id,
|
39
43
|
'chef_branch', data['chef_branch'],
|
40
|
-
'chef_repo', data['chef_repo']
|
44
|
+
'chef_repo', data['chef_repo'],
|
45
|
+
'chef_runlist', chef_runlist)
|
41
46
|
$redis.expire(host_key, 86400)
|
42
47
|
"{\"instance\":\"#{instance.id}\"}"
|
43
48
|
end
|
@@ -75,6 +80,17 @@ class GaptoolServer < Sinatra::Application
|
|
75
80
|
@apps << app.gsub('app:', '')
|
76
81
|
end
|
77
82
|
end
|
83
|
+
|
84
|
+
init_recipe = 'recipe[init]'
|
85
|
+
@run_list = [init_recipe]
|
86
|
+
unless host_data['chef_runlist'].nil? || host_data['chef_runlist'].empty?
|
87
|
+
@run_list = [*host_data['chef_runlist']]
|
88
|
+
unless @run_list.include? init_recipe
|
89
|
+
@run_list.unshift(init_recipe)
|
90
|
+
end
|
91
|
+
data['chef_runlist'] = @run_list.to_json
|
92
|
+
end
|
93
|
+
|
78
94
|
data.merge!("capacity" => $redis.hget('capacity', data['itype']))
|
79
95
|
data.merge!("hostname" => hostname)
|
80
96
|
data.merge!("apps" => @apps.to_json)
|
@@ -89,7 +105,7 @@ class GaptoolServer < Sinatra::Application
|
|
89
105
|
'recipe' => 'init',
|
90
106
|
'number' => @instance.id,
|
91
107
|
'instance' => @instance.id,
|
92
|
-
'run_list' =>
|
108
|
+
'run_list' => @run_list,
|
93
109
|
'role' => data['role'],
|
94
110
|
'environment' => data['environment'],
|
95
111
|
'chefrepo' => @chef_repo,
|