gaptool-server 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/routes/main.rb +18 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb3ddb2edeff7fc5c0e65af1f416200aad0d3e77
4
- data.tar.gz: 119e49e661640aa92380d33a7e87f6bd157de534
3
+ metadata.gz: 916d4e82528c729ee6340c99917251a702a2be4d
4
+ data.tar.gz: fe7c48d8ceb9f715473ecacf1c35c6ef0ef12486
5
5
  SHA512:
6
- metadata.gz: ab801da4cde39212f65f98b0c86669b55e743c7757a4fd7e7ec0e44843c535e5b7e2e14784ded3601739753b9d7dc5777dfb544b5864bc1783598d5dce05988c
7
- data.tar.gz: 704a2b2bf86916337dedd9c53559ff763c3fbf81b09e7884d18d0a836bed98bb00a6e821569f491efd1992eeffd6f6e15f36b5ffa44e51d0de248667b53fa63a
6
+ metadata.gz: 35a9925d8817c15b51ed2e65034a1abc665d3bad786bab797da818ec611202dc73c68d3103272b08f3fe2587b45d3d3f8969b44caa6616a67ed6f96d5a7920fd
7
+ data.tar.gz: 729bb7e534b3e4b9e9224756b8d6a950ef81507f20e3f81a08719f8f29b2fcc2f7d94a376ceba07248caa52961029e123ff80377ba541dc81ef46a44cbc481fb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.7
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' => ['recipe[init]'],
108
+ 'run_list' => @run_list,
93
109
  'role' => data['role'],
94
110
  'environment' => data['environment'],
95
111
  'chefrepo' => @chef_repo,
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.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Bailey