gaptool-server 0.5.8 → 0.5.10
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 +23 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a3cbf9109ddfda49338e44b50611176d1f9decc
|
4
|
+
data.tar.gz: bce8974307d73e758d40407c3a7eb82d647fa5b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad0b86f94a32d8bbca60aba3d76748a73d32e16ba36ebc9af178c7dd590b05297890e600976830881ba14258b3acae4a363e915febb26ddf73c133ace632321e
|
7
|
+
data.tar.gz: 33e5cd8d552c17a1c099afaa2a611fa74441e9ec0235167733c7189c1b67e473a3be660cace2fbeff9d117b02c3a5c14ceed1a9960b4b2e7246d0fee22d81ce7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.10
|
data/lib/routes/main.rb
CHANGED
@@ -22,6 +22,12 @@ class GaptoolServer < Sinatra::Application
|
|
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
24
|
chef_runlist = $redis.hget("role:#{data['role']}", "chef_runlist")
|
25
|
+
|
26
|
+
terminate = true
|
27
|
+
unless data['terminate'].nil?
|
28
|
+
terminate = false
|
29
|
+
end
|
30
|
+
|
25
31
|
unless data['chef_runlist'].nil?
|
26
32
|
chef_runlist = data['chef_runlist'].to_json
|
27
33
|
end
|
@@ -42,7 +48,8 @@ class GaptoolServer < Sinatra::Application
|
|
42
48
|
$redis.hmset(host_key, 'instance_id', instance.id,
|
43
49
|
'chef_branch', data['chef_branch'],
|
44
50
|
'chef_repo', data['chef_repo'],
|
45
|
-
'chef_runlist', chef_runlist
|
51
|
+
'chef_runlist', chef_runlist,
|
52
|
+
'terminate', terminate)
|
46
53
|
$redis.expire(host_key, 86400)
|
47
54
|
"{\"instance\":\"#{instance.id}\"}"
|
48
55
|
end
|
@@ -52,6 +59,18 @@ class GaptoolServer < Sinatra::Application
|
|
52
59
|
AWS.config(:access_key_id => $redis.hget('config', 'aws_id'),
|
53
60
|
:secret_access_key => $redis.hget('config', 'aws_secret'),
|
54
61
|
:ec2_endpoint => "ec2.#{data['zone']}.amazonaws.com")
|
62
|
+
keys = $redis.keys("*:*:#{data['id']}")
|
63
|
+
if keys.nil? || keys.empty?
|
64
|
+
error 404
|
65
|
+
end
|
66
|
+
if keys.length >= 1
|
67
|
+
error 409
|
68
|
+
end
|
69
|
+
data = $redis.hgetall(keys.first)
|
70
|
+
if data['terminate'] == false
|
71
|
+
error 403
|
72
|
+
end
|
73
|
+
|
55
74
|
@ec2 = AWS::EC2.new
|
56
75
|
@instance = @ec2.instances[data['id']]
|
57
76
|
res = @instance.terminate
|
@@ -83,8 +102,8 @@ class GaptoolServer < Sinatra::Application
|
|
83
102
|
|
84
103
|
init_recipe = 'recipe[init]'
|
85
104
|
@run_list = [init_recipe]
|
86
|
-
unless host_data['chef_runlist'].nil?
|
87
|
-
@run_list = [*host_data['chef_runlist']]
|
105
|
+
unless host_data['chef_runlist'].nil?
|
106
|
+
@run_list = [*eval(host_data['chef_runlist'])]
|
88
107
|
unless @run_list.include? init_recipe
|
89
108
|
@run_list.unshift(init_recipe)
|
90
109
|
end
|
@@ -95,6 +114,7 @@ class GaptoolServer < Sinatra::Application
|
|
95
114
|
data.merge!("hostname" => hostname)
|
96
115
|
data.merge!("apps" => @apps.to_json)
|
97
116
|
data.merge!("instance" => @instance.id)
|
117
|
+
data['terminate'] = host_data['terminate'].nil? ? 'true' : host_data['terminate']
|
98
118
|
hash2redis("host:#{data['role']}:#{data['environment']}:#{@instance.id}", data)
|
99
119
|
|
100
120
|
@chef_repo = host_data['chef_repo'] && !host_data['chef_repo'].empty? ? host_data['chef_repo'] : $redis.hget('config', 'chefrepo')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaptool-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Bailey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
239
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.
|
240
|
+
rubygems_version: 2.4.1
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: gaptool-server for managing cloud resources
|