gaptool-server 0.7.1 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91476ed75e704cd7168262de3aee3563632c6571
4
- data.tar.gz: 6e20d2d9cfd1f1e6d386bf3f8b801ef353cae179
3
+ metadata.gz: 3fe780828627a2729cb25b73f9621d11a030dfc5
4
+ data.tar.gz: 0e25f2f0b1d5b16a59556bbb9436dd6018662dea
5
5
  SHA512:
6
- metadata.gz: db20d97b206b75e2753165da1eb30047ff8afede719f0e262477773187d19b916ec1fd9d3faae18a3e6fab08524d62fc9233c4affd0e90e9ef77634da105fbf8
7
- data.tar.gz: c56b3aa929695a7b9948580ad0c65e0fdaf76c2df6d0d35d4c2c122eb0f77ca21898b46ba0a867c7014c20b7c532b73b6a44eb11e063719e2d8b201066247d9d
6
+ metadata.gz: d51261d37954470fca761afe83357e6a44a6f1b8aa2fdeb214e402e41938687668a44293ee4d206c43f3d9246d07133c531e418717f497f2f7a3e973d6316822
7
+ data.tar.gz: 0f2cf85707b65a8c09e14c658e74be25039b82e3abaf3280dac85ac79e98ee028d287005609db6ff0d9284ee7206f52264094bb58bfa1eaf0a1d4fb43a67a859
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.3
data/tasks/docker.rb CHANGED
@@ -6,7 +6,7 @@ unless File.exists?('/.dockerenv')
6
6
  namespace :docker do
7
7
  namespace :build do
8
8
  task :image do
9
- sys(%w(./scripts/build_docker_images.sh))
9
+ sys(%w(./scripts/build_docker_images.sh -l))
10
10
  printimages
11
11
  end
12
12
 
data/tasks/role.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'pp'
2
+
1
3
  namespace :role do
2
4
  desc "Set security group for a role"
3
5
  task :set_sg, [:role, :environment, :security_group] do |t, args|
@@ -6,4 +8,46 @@ namespace :role do
6
8
  role['sg'].merge!(args[:environment] => args[:security_group])
7
9
  DH.save_role_data(args[:role], role)
8
10
  end
11
+
12
+ desc "Set ami for role"
13
+ task :set_amis, [:role, :region, :ami_id] do |t, args|
14
+ abort("Missing parameters") if args[:role].nil? || args[:region].nil? || args[:role].empty? || args[:region].empty? || args[:ami_id].nil? || args[:ami_id].empty?
15
+ role = DH.get_role_data(args[:role])
16
+ role['amis'].merge!(args[:region], args[:ami_id])
17
+ DH.save_role_data(args[:role], role)
18
+ end
19
+
20
+ desc "Set runlist for role; Runlist must be a comma separated string of recipes and roles. e.g. 'recipe[recipe],role[otherrole]'"
21
+ task :set_chef_runlist, [:role, :chef_runlist] do |t, args|
22
+ abort("Missing parameters") if args[:role].nil? || args[:chef_runlist].nil? || args[:role].empty? || args[:chef_runlist].empty?
23
+ role = DH.get_role_data(args[:role])
24
+ rl = args[:chef_runlist].strip.split(",").map{|x| x.strip}.to_json
25
+ role['chef_runlist'] = rl
26
+ DH.save_role_data(args[:role], role)
27
+ puts "Added runlist for role #{role}"
28
+ end
29
+
30
+ desc "Remove a role, if there are no instances running"
31
+ task :remove, [:role] do |t, args|
32
+ abort("Missing parameters") if args[:role].nil? || args[:role].empty?
33
+ res = DH.remove_role(args[:role])
34
+ if res == true
35
+ puts "Removed role #{args[:role]}"
36
+ else
37
+ puts "Cannot remove role: #{res.inspect}"
38
+ end
39
+ end
40
+ end
41
+
42
+ desc "List all roles (environment is optional but needed to display apps)"
43
+ task :role, [:environment] do |t, args|
44
+ env = args[:environment]
45
+ puts "Roles:"
46
+ DH.roles(env).each do |role, info|
47
+ puts "* #{role}:"
48
+ puts " - apps: #{info['apps'].join(", ")}"
49
+ puts " - sg: #{info['sg'].values.join(", ")}"
50
+ puts " - amis: #{info['amis'].map{|k,v| "#{v} (#{k})"}.join(", ")}"
51
+ puts " - runlist: #{info['chef_runlist'].to_a.join(", ")}"
52
+ end
9
53
  end
data/test/data_test.rb CHANGED
@@ -106,7 +106,7 @@ describe "data helpers" do
106
106
  DH.save_role_data("role", chef_runlist: ["recipe[myrecipe]"].to_json)
107
107
  DH.addserver(instid, data, nil)
108
108
  role = DH.get_role_data("role", "testenv")
109
- expect(role).to eq({"chef_runlist"=> ["recipe[myrecipe]"].to_json,
109
+ expect(role).to eq({"chef_runlist"=> ["recipe[myrecipe]"],
110
110
  "apps" => [],
111
111
  "amis" => {},
112
112
  "sg" => {}})
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.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Bailey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-09 00:00:00.000000000 Z
13
+ date: 2015-06-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra