toquen 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ desc "update local cache of servers and roles"
5
5
  task :update_roles do
6
6
  load Pathname.new fetch(:deploy_config_path, 'config/deploy.rb')
7
7
  roles = Hash.new([])
8
+ servers = []
8
9
 
9
10
  aws = Toquen::AWSProxy.new
10
11
  aws.server_details.each do |details|
@@ -12,9 +13,13 @@ task :update_roles do
12
13
  roles['all'] += [details]
13
14
  Toquen::LocalWriter.create_databag_item details
14
15
  Toquen::LocalWriter.create_stage "server-#{details[:name]}", [details]
16
+ servers << details[:name]
15
17
  end
16
18
 
17
19
  roles.each { |name, servers| Toquen::LocalWriter.create_stage name, servers }
20
+
21
+ # Look for any superfluous servers / roles
22
+ Toquen::LocalWriter.superfluous_check!(servers, roles.keys)
18
23
  end
19
24
 
20
25
  desc "bootstrap a server so that it can run chef"
@@ -18,5 +18,23 @@ module Toquen
18
18
  f.write("set :filter, roles: %w{#{name}}\n")
19
19
  end
20
20
  end
21
+
22
+ def self.superfluous_check!(servers, roles)
23
+ # check for superflous stages / data bag items and warn if found
24
+ run_locally do
25
+ Dir["#{fetch(:chef_data_bags_path)}/servers/*.json"].each { |path|
26
+ unless servers.include? File.basename(path, ".json")
27
+ warn "Data bag item #{path} does not represent an active server. You should delete it."
28
+ end
29
+ }
30
+
31
+ stages = roles + servers.map { |n| "server-#{n}" }
32
+ Dir["config/deploy/*.rb"].each { |path|
33
+ unless stages.include? File.basename(path, ".rb")
34
+ warn "Stage #{path} does not represent an active server. You should delete it."
35
+ end
36
+ }
37
+ end
38
+ end
21
39
  end
22
40
  end
@@ -1,3 +1,3 @@
1
1
  module Toquen
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,60 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: toquen
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
4
5
  prerelease:
5
- version: 0.0.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Brian Muller
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-12-17 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-12-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: capistrano
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
18
+ requirements:
20
19
  - - ~>
21
- - !ruby/object:Gem::Version
20
+ - !ruby/object:Gem::Version
22
21
  version: 3.0.1
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.1
30
+ - !ruby/object:Gem::Dependency
27
31
  name: aws-sdk
28
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
38
47
  name: rdoc
39
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *id003
48
- description: "Toquen: Capistrano + AWS + Chef-Solo"
49
- email:
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: ! 'Toquen: Capistrano + AWS + Chef-Solo'
63
+ email:
50
64
  - bamuller@gmail.com
51
65
  executables: []
52
-
53
66
  extensions: []
54
-
55
67
  extra_rdoc_files: []
56
-
57
- files:
68
+ files:
58
69
  - .gitignore
59
70
  - Gemfile
60
71
  - LICENSE.txt
@@ -71,36 +82,32 @@ files:
71
82
  - toquen.gemspec
72
83
  homepage: https://github.com/bmuller/toquen
73
84
  licenses: []
74
-
75
85
  post_install_message:
76
86
  rdoc_options: []
77
-
78
- require_paths:
87
+ require_paths:
79
88
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
89
+ required_ruby_version: !ruby/object:Gem::Requirement
81
90
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 652687701132205552
86
- segments:
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ segments:
87
96
  - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
97
+ hash: 458673476239489865
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
99
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 652687701132205552
95
- segments:
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ segments:
96
105
  - 0
97
- version: "0"
106
+ hash: 458673476239489865
98
107
  requirements: []
99
-
100
108
  rubyforge_project:
101
- rubygems_version: 1.8.24
109
+ rubygems_version: 1.8.25
102
110
  signing_key:
103
111
  specification_version: 3
104
- summary: "Toquen: Capistrano + AWS + Chef-Solo"
112
+ summary: ! 'Toquen: Capistrano + AWS + Chef-Solo'
105
113
  test_files: []
106
-