cluster_chef 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +51 -0
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +63 -0
  4. data/Gemfile +18 -0
  5. data/LICENSE +201 -0
  6. data/README.md +332 -0
  7. data/Rakefile +92 -0
  8. data/TODO.md +8 -0
  9. data/VERSION +1 -0
  10. data/chefignore +41 -0
  11. data/cluster_chef.gemspec +115 -0
  12. data/clusters/website_demo.rb +65 -0
  13. data/config/client.rb +59 -0
  14. data/lib/cluster_chef/chef_layer.rb +297 -0
  15. data/lib/cluster_chef/cloud.rb +409 -0
  16. data/lib/cluster_chef/cluster.rb +118 -0
  17. data/lib/cluster_chef/compute.rb +144 -0
  18. data/lib/cluster_chef/cookbook_munger/README.md.erb +47 -0
  19. data/lib/cluster_chef/cookbook_munger/licenses.yaml +16 -0
  20. data/lib/cluster_chef/cookbook_munger/metadata.rb.erb +23 -0
  21. data/lib/cluster_chef/cookbook_munger.rb +588 -0
  22. data/lib/cluster_chef/deprecated.rb +33 -0
  23. data/lib/cluster_chef/discovery.rb +158 -0
  24. data/lib/cluster_chef/dsl_object.rb +123 -0
  25. data/lib/cluster_chef/facet.rb +144 -0
  26. data/lib/cluster_chef/fog_layer.rb +134 -0
  27. data/lib/cluster_chef/private_key.rb +110 -0
  28. data/lib/cluster_chef/role_implications.rb +49 -0
  29. data/lib/cluster_chef/security_group.rb +103 -0
  30. data/lib/cluster_chef/server.rb +265 -0
  31. data/lib/cluster_chef/server_slice.rb +259 -0
  32. data/lib/cluster_chef/volume.rb +93 -0
  33. data/lib/cluster_chef.rb +137 -0
  34. data/notes/aws_console_screenshot.jpg +0 -0
  35. data/rspec.watchr +29 -0
  36. data/spec/cluster_chef/cluster_spec.rb +13 -0
  37. data/spec/cluster_chef/facet_spec.rb +70 -0
  38. data/spec/cluster_chef/server_slice_spec.rb +19 -0
  39. data/spec/cluster_chef/server_spec.rb +112 -0
  40. data/spec/cluster_chef_spec.rb +193 -0
  41. data/spec/spec_helper/dummy_chef.rb +25 -0
  42. data/spec/spec_helper.rb +50 -0
  43. data/spec/test_config.rb +20 -0
  44. data/tasks/chef_config.rb +38 -0
  45. data/tasks/jeweler_use_alt_branch.rb +47 -0
  46. metadata +227 -0
@@ -0,0 +1,25 @@
1
+ shared_context 'dummy_chef' do
2
+ before(:each) do
3
+ Chef::Log.logger = Logger.new(StringIO.new)
4
+
5
+ Chef::Config[:node_name] = "webmonkey.example.com"
6
+ ClusterChef.ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, {})
7
+ ClusterChef.ui.stub!(:puts)
8
+ ClusterChef.ui.stub!(:print)
9
+ Chef::Log.stub!(:init)
10
+ Chef::Log.stub!(:level)
11
+ [:debug, :info, :warn, :error, :crit].each do |level_sym|
12
+ Chef::Log.stub!(level_sym)
13
+ end
14
+ Chef::Knife.stub!(:puts)
15
+ @stdout = StringIO.new
16
+ end
17
+
18
+
19
+ let(:node_name){ 'a_dummy_node' }
20
+ let(:dummy_node){ Chef::Node.new }
21
+ before(:each) do
22
+ # ClusterChef::Cluster.stub!(:chef_nodes).and_return( [dummy_node] )
23
+ ClusterChef::Server.stub!(:chef_node).and_return( dummy_node )
24
+ end
25
+ end
@@ -0,0 +1,50 @@
1
+ require 'rubygems' unless defined?(Gem)
2
+ require 'bundler'
3
+ # begin
4
+ # Bundler.setup(:default, :development)
5
+ # rescue Bundler::BundlerError => e
6
+ # $stderr.puts e.message
7
+ # $stderr.puts "Run `bundle install` to install missing gems"
8
+ # exit e.status_code
9
+ # end
10
+ require 'spork'
11
+
12
+ unless defined?(CLUSTER_CHEF_DIR)
13
+ CLUSTER_CHEF_DIR = File.expand_path(File.dirname(__FILE__)+'/..')
14
+ def CLUSTER_CHEF_DIR(*paths) File.join(CLUSTER_CHEF_DIR, *paths); end
15
+ # load from vendored libraries, if present
16
+ Dir[CLUSTER_CHEF_DIR("vendor/*/lib")].each{|dir| p dir ; $LOAD_PATH.unshift(File.expand_path(dir)) } ; $LOAD_PATH.uniq!
17
+ end
18
+
19
+ Spork.prefork do # This code is run only once when the spork server is started
20
+
21
+ require 'rspec'
22
+ require 'chef'
23
+ require 'chef/knife'
24
+ require 'fog'
25
+
26
+ Fog.mock!
27
+ Fog::Mock.delay = 0
28
+
29
+ CHEF_CONFIG_FILE = File.expand_path(CLUSTER_CHEF_DIR('spec/test_config.rb')) unless defined?(CHEF_CONFIG_FILE)
30
+ Chef::Config.from_file(CHEF_CONFIG_FILE)
31
+
32
+ # Requires custom matchers & macros, etc from files in ./spec_helper/
33
+ Dir[CLUSTER_CHEF_DIR("spec/spec_helper/*.rb")].each {|f| require f}
34
+
35
+ def load_example_cluster(name)
36
+ require(CLUSTER_CHEF_DIR('clusters', "#{name}.rb"))
37
+ end
38
+ def get_example_cluster name
39
+ load_example_cluster(name)
40
+ ClusterChef.cluster(name)
41
+ end
42
+
43
+ # Configure rspec
44
+ RSpec.configure do |config|
45
+ end
46
+ end
47
+
48
+ Spork.each_run do
49
+ # This code will be run each time you run your specs.
50
+ end
@@ -0,0 +1,20 @@
1
+ current_dir = File.expand_path('~/.chef')
2
+ organization = 'infochimps'
3
+ username = 'mrflip'
4
+
5
+ cookbook_root = ENV['PATH_TO_COOKBOOK_REPOS'] || File.expand_path('~/ics/sysadmin')
6
+
7
+ cluster_chef_path File.expand_path(cookbook_root+'/cluster_chef')
8
+ keypair_path File.expand_path(current_dir+"/keypairs")
9
+ cookbook_path [
10
+ "cluster_chef/cookbooks", "cluster_chef/site-cookbooks",
11
+ ].map{|path| File.join(cookbook_root, path) }
12
+ cluster_path [
13
+ 'cluster_chef/clusters',
14
+ ].map{|path| File.join(cookbook_root, path) }
15
+
16
+ node_name username
17
+ validation_client_name "chef-validator"
18
+ validation_key "#{keypair_path}/#{organization}-validator.pem"
19
+ client_key "#{keypair_path}/#{username}-client_key.pem"
20
+ chef_server_url "https://api.opscode.com/organizations/#{organization}"
@@ -0,0 +1,38 @@
1
+ # Configure the Rakefile's tasks.
2
+
3
+ ###
4
+ # Company and SSL Details
5
+ # Used with the ssl_cert task.
6
+ ###
7
+
8
+ # The company name - used for SSL certificates, and in srvious other places
9
+ COMPANY_NAME = "Infochimps, Inc"
10
+
11
+ # The Country Name to use for SSL Certificates
12
+ SSL_COUNTRY_NAME = "US"
13
+
14
+ # The State Name to use for SSL Certificates
15
+ SSL_STATE_NAME = "Several"
16
+
17
+ # The Locality Name for SSL - typically, the city
18
+ SSL_LOCALITY_NAME = "Locality"
19
+
20
+ # What department?
21
+ SSL_ORGANIZATIONAL_UNIT_NAME = "Operations"
22
+
23
+ # The SSL contact email address
24
+ SSL_EMAIL_ADDRESS = "coders@infochimps.com"
25
+
26
+ # License for new Cookbooks
27
+ # Can be :apachev2 or :none
28
+ NEW_COOKBOOK_LICENSE = :apachev2
29
+
30
+ ###
31
+ # Useful Extras (which you probably don't need to change)
32
+ ###
33
+
34
+ # The top of the repository checkout
35
+ TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
36
+
37
+ # Where to store certificates generated with ssl_cert
38
+ CADIR = File.expand_path(File.join(TOPDIR, "certificates"))
@@ -0,0 +1,47 @@
1
+
2
+ #
3
+ # Jeweler has hardcoded the 'master' branch as where to push from.
4
+ # We hardcode it right back in.
5
+ #
6
+
7
+ module Jeweler::Commands
8
+
9
+ PUSH_FROM_BRANCH = 'version_3' unless defined?(PUSH_FROM_BRANCH)
10
+
11
+ ReleaseToGit.class_eval do
12
+ def run
13
+ unless clean_staging_area?
14
+ system "git status"
15
+ raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
16
+ end
17
+
18
+ repo.checkout(PUSH_FROM_BRANCH)
19
+ repo.push
20
+
21
+ if release_not_tagged?
22
+ output.puts "Tagging #{release_tag}"
23
+ repo.add_tag(release_tag)
24
+
25
+ output.puts "Pushing #{release_tag} to origin"
26
+ repo.push('origin', release_tag)
27
+ end
28
+ end
29
+ end
30
+
31
+ ReleaseGemspec.class_eval do
32
+ def run
33
+ unless clean_staging_area?
34
+ system "git status"
35
+ raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
36
+ end
37
+
38
+ repo.checkout(PUSH_FROM_BRANCH)
39
+
40
+ regenerate_gemspec!
41
+ commit_gemspec! if gemspec_changed?
42
+
43
+ output.puts "Pushing #{PUSH_FROM_BRANCH} to origin"
44
+ repo.push
45
+ end
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cluster_chef
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.5
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Infochimps
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chef
16
+ requirement: &70325818912360 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.10.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70325818912360
25
+ - !ruby/object:Gem::Dependency
26
+ name: fog
27
+ requirement: &70325818911800 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.1
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70325818911800
36
+ - !ruby/object:Gem::Dependency
37
+ name: formatador
38
+ requirement: &70325819294520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.2.1
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70325819294520
47
+ - !ruby/object:Gem::Dependency
48
+ name: gorillib
49
+ requirement: &70325819294040 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.7
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70325819294040
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: &70325819293560 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70325819293560
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: &70325819293060 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 0.6.7
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70325819293060
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &70325819292540 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.6.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70325819292540
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: &70325819292060 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 2.7.0
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70325819292060
102
+ - !ruby/object:Gem::Dependency
103
+ name: configliere
104
+ requirement: &70325819291520 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.4.8
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70325819291520
113
+ - !ruby/object:Gem::Dependency
114
+ name: spork
115
+ requirement: &70325819291020 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: 0.9.0.rc5
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70325819291020
124
+ - !ruby/object:Gem::Dependency
125
+ name: watchr
126
+ requirement: &70325819290540 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '0.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *70325819290540
135
+ description: cluster_chef allows you to orchestrate not just systems but clusters
136
+ of machines. It includes a powerful layer on top of knife and a collection of cloud
137
+ cookbooks.
138
+ email: coders@infochimps.com
139
+ executables: []
140
+ extensions: []
141
+ extra_rdoc_files:
142
+ - LICENSE
143
+ - README.md
144
+ files:
145
+ - .gitignore
146
+ - .rspec
147
+ - CHANGELOG.md
148
+ - Gemfile
149
+ - LICENSE
150
+ - README.md
151
+ - Rakefile
152
+ - TODO.md
153
+ - VERSION
154
+ - chefignore
155
+ - cluster_chef.gemspec
156
+ - clusters/website_demo.rb
157
+ - config/client.rb
158
+ - lib/cluster_chef.rb
159
+ - lib/cluster_chef/chef_layer.rb
160
+ - lib/cluster_chef/cloud.rb
161
+ - lib/cluster_chef/cluster.rb
162
+ - lib/cluster_chef/compute.rb
163
+ - lib/cluster_chef/cookbook_munger.rb
164
+ - lib/cluster_chef/cookbook_munger/README.md.erb
165
+ - lib/cluster_chef/cookbook_munger/licenses.yaml
166
+ - lib/cluster_chef/cookbook_munger/metadata.rb.erb
167
+ - lib/cluster_chef/deprecated.rb
168
+ - lib/cluster_chef/discovery.rb
169
+ - lib/cluster_chef/dsl_object.rb
170
+ - lib/cluster_chef/facet.rb
171
+ - lib/cluster_chef/fog_layer.rb
172
+ - lib/cluster_chef/private_key.rb
173
+ - lib/cluster_chef/role_implications.rb
174
+ - lib/cluster_chef/security_group.rb
175
+ - lib/cluster_chef/server.rb
176
+ - lib/cluster_chef/server_slice.rb
177
+ - lib/cluster_chef/volume.rb
178
+ - notes/aws_console_screenshot.jpg
179
+ - rspec.watchr
180
+ - spec/cluster_chef/cluster_spec.rb
181
+ - spec/cluster_chef/facet_spec.rb
182
+ - spec/cluster_chef/server_slice_spec.rb
183
+ - spec/cluster_chef/server_spec.rb
184
+ - spec/cluster_chef_spec.rb
185
+ - spec/spec_helper.rb
186
+ - spec/spec_helper/dummy_chef.rb
187
+ - spec/test_config.rb
188
+ - tasks/chef_config.rb
189
+ - tasks/jeweler_use_alt_branch.rb
190
+ homepage: http://infochimps.com/labs
191
+ licenses:
192
+ - apachev2
193
+ post_install_message:
194
+ rdoc_options: []
195
+ require_paths:
196
+ - lib
197
+ required_ruby_version: !ruby/object:Gem::Requirement
198
+ none: false
199
+ requirements:
200
+ - - ! '>='
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ segments:
204
+ - 0
205
+ hash: 3687247056688648988
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ none: false
208
+ requirements:
209
+ - - ! '>='
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ requirements: []
213
+ rubyforge_project:
214
+ rubygems_version: 1.8.11
215
+ signing_key:
216
+ specification_version: 3
217
+ summary: cluster_chef allows you to orchestrate not just systems but clusters of machines.
218
+ It includes a powerful layer on top of knife and a collection of cloud cookbooks.
219
+ test_files:
220
+ - spec/cluster_chef/cluster_spec.rb
221
+ - spec/cluster_chef/facet_spec.rb
222
+ - spec/cluster_chef/server_slice_spec.rb
223
+ - spec/cluster_chef/server_spec.rb
224
+ - spec/cluster_chef_spec.rb
225
+ - spec/spec_helper/dummy_chef.rb
226
+ - spec/spec_helper.rb
227
+ - spec/test_config.rb