ironfan 5.0.11 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/.gitignore +4 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +8 -26
  4. data/Gemfile.lock +38 -41
  5. data/NOTES-REALM.md +172 -0
  6. data/Rakefile +19 -77
  7. data/config/ubuntu12.04-ironfan.erb +7 -0
  8. data/ironfan.gemspec +28 -225
  9. data/lib/chef/cluster_knife.rb +26 -0
  10. data/lib/chef/knife/bootstrap/ubuntu12.04-ironfan.erb +7 -0
  11. data/lib/chef/knife/cluster_bootstrap.rb +1 -3
  12. data/lib/chef/knife/cluster_diff.rb +2 -8
  13. data/lib/chef/knife/cluster_kick.rb +1 -3
  14. data/lib/chef/knife/cluster_kill.rb +1 -2
  15. data/lib/chef/knife/cluster_launch.rb +17 -34
  16. data/lib/chef/knife/cluster_list.rb +6 -5
  17. data/lib/chef/knife/cluster_proxy.rb +1 -3
  18. data/lib/chef/knife/cluster_pry.rb +1 -2
  19. data/lib/chef/knife/cluster_show.rb +6 -7
  20. data/lib/chef/knife/cluster_ssh.rb +10 -8
  21. data/lib/chef/knife/cluster_start.rb +1 -2
  22. data/lib/chef/knife/cluster_stop.rb +1 -2
  23. data/lib/chef/knife/cluster_sync.rb +2 -3
  24. data/lib/chef/knife/ironfan_knife_common.rb +58 -18
  25. data/lib/chef/knife/ironfan_script.rb +0 -3
  26. data/lib/ironfan/broker/computer.rb +14 -11
  27. data/lib/ironfan/broker.rb +17 -12
  28. data/lib/ironfan/cookbook_requirements.rb +155 -0
  29. data/lib/ironfan/dsl/cloud.rb +2 -0
  30. data/lib/ironfan/dsl/cluster.rb +25 -15
  31. data/lib/ironfan/dsl/component.rb +12 -15
  32. data/lib/ironfan/dsl/compute.rb +10 -8
  33. data/lib/ironfan/dsl/ec2.rb +2 -26
  34. data/lib/ironfan/dsl/facet.rb +16 -14
  35. data/lib/ironfan/dsl/openstack.rb +147 -0
  36. data/lib/ironfan/dsl/realm.rb +23 -16
  37. data/lib/ironfan/dsl/security_group.rb +29 -0
  38. data/lib/ironfan/dsl/server.rb +14 -5
  39. data/lib/ironfan/dsl/static.rb +63 -0
  40. data/lib/ironfan/dsl/vsphere.rb +1 -0
  41. data/lib/ironfan/dsl.rb +1 -134
  42. data/lib/ironfan/headers.rb +19 -0
  43. data/lib/ironfan/provider/chef/node.rb +3 -2
  44. data/lib/ironfan/provider/ec2/machine.rb +10 -14
  45. data/lib/ironfan/provider/ec2/security_group.rb +58 -43
  46. data/lib/ironfan/provider/openstack/elastic_ip.rb +96 -0
  47. data/lib/ironfan/provider/openstack/keypair.rb +78 -0
  48. data/lib/ironfan/provider/openstack/machine.rb +371 -0
  49. data/lib/ironfan/provider/openstack/security_group.rb +224 -0
  50. data/lib/ironfan/provider/openstack.rb +69 -0
  51. data/lib/ironfan/provider/static/machine.rb +192 -0
  52. data/lib/ironfan/provider/static.rb +23 -0
  53. data/lib/ironfan/provider.rb +58 -1
  54. data/lib/ironfan/requirements.rb +17 -1
  55. data/lib/ironfan/version.rb +3 -0
  56. data/lib/ironfan.rb +107 -172
  57. data/spec/chef/cluster_bootstrap_spec.rb +2 -7
  58. data/spec/chef/cluster_launch_spec.rb +1 -2
  59. data/spec/fixtures/realms/samurai.rb +26 -0
  60. data/spec/integration/minimal-chef-repo/clusters/.gitkeep +0 -0
  61. data/spec/integration/minimal-chef-repo/config/.gitkeep +0 -0
  62. data/spec/integration/minimal-chef-repo/knife/credentials/.gitignore +1 -0
  63. data/spec/integration/minimal-chef-repo/knife/credentials/certificates/.gitkeep +0 -0
  64. data/spec/integration/minimal-chef-repo/knife/credentials/client_keys/.gitkeep +0 -0
  65. data/spec/integration/minimal-chef-repo/knife/credentials/data_bag_keys/.gitkeep +0 -0
  66. data/spec/integration/minimal-chef-repo/knife/credentials/ec2_certs/.gitkeep +0 -0
  67. data/spec/integration/minimal-chef-repo/knife/credentials/ec2_keys/.gitkeep +0 -0
  68. data/spec/integration/minimal-chef-repo/knife/credentials/ironfantest-validator.pem +27 -0
  69. data/spec/integration/minimal-chef-repo/knife/credentials/ironfantester.pem +27 -0
  70. data/spec/integration/minimal-chef-repo/tasks/.gitkeep +0 -0
  71. data/spec/ironfan/cluster_spec.rb +1 -2
  72. data/spec/ironfan/diff_spec.rb +0 -2
  73. data/spec/ironfan/dsl_spec.rb +6 -3
  74. data/spec/ironfan/ec2/cloud_provider_spec.rb +17 -18
  75. data/spec/ironfan/ec2/elb_spec.rb +44 -41
  76. data/spec/ironfan/ec2/security_group_spec.rb +45 -47
  77. data/spec/ironfan/manifest_spec.rb +0 -1
  78. data/spec/ironfan/plugin_spec.rb +55 -40
  79. data/spec/ironfan/realm_spec.rb +42 -30
  80. data/spec/spec_helper.rb +17 -31
  81. data/spec/{spec_helper → support}/dummy_chef.rb +0 -0
  82. data/spec/{spec_helper → support}/dummy_diff_drawer.rb +0 -0
  83. metadata +78 -155
  84. data/.rspec +0 -2
  85. data/.yardopts +0 -19
  86. data/VERSION +0 -2
  87. data/chefignore +0 -41
  88. data/notes/Future-development-proposals.md +0 -266
  89. data/notes/Home.md +0 -55
  90. data/notes/INSTALL-cloud_setup.md +0 -103
  91. data/notes/INSTALL.md +0 -134
  92. data/notes/Ironfan-Roadmap.md +0 -70
  93. data/notes/Upgrading-to-v4.md +0 -66
  94. data/notes/advanced-superpowers.md +0 -16
  95. data/notes/aws_servers.jpg +0 -0
  96. data/notes/aws_user_key.png +0 -0
  97. data/notes/cookbook-versioning.md +0 -11
  98. data/notes/core_concepts.md +0 -200
  99. data/notes/declaring_volumes.md +0 -3
  100. data/notes/design_notes-aspect_oriented_devops.md +0 -36
  101. data/notes/design_notes-ci_testing.md +0 -169
  102. data/notes/design_notes-cookbook_event_ordering.md +0 -249
  103. data/notes/design_notes-meta_discovery.md +0 -59
  104. data/notes/ec2-pricing_and_capacity.md +0 -75
  105. data/notes/ec2-pricing_and_capacity.numbers +0 -0
  106. data/notes/homebase-layout.txt +0 -102
  107. data/notes/knife-cluster-commands.md +0 -21
  108. data/notes/named-cloud-objects.md +0 -11
  109. data/notes/opscode_org_key.png +0 -0
  110. data/notes/opscode_user_key.png +0 -0
  111. data/notes/philosophy.md +0 -13
  112. data/notes/rake_tasks.md +0 -24
  113. data/notes/renamed-recipes.txt +0 -142
  114. data/notes/silverware.md +0 -85
  115. data/notes/style_guide.md +0 -300
  116. data/notes/tips_and_troubleshooting.md +0 -92
  117. data/notes/walkthrough-hadoop.md +0 -168
  118. data/notes/walkthrough-web.md +0 -166
  119. data/spec/fixtures/gunbai.rb +0 -24
  120. data/spec/test_config.rb +0 -20
  121. data/tasks/chef_config.rake +0 -38
data/ironfan.gemspec CHANGED
@@ -1,230 +1,33 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ironfan/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "ironfan"
8
- s.version = "5.0.11"
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'ironfan'
8
+ gem.version = Ironfan::VERSION
9
+ gem.authors = %w[ Infochimps ]
10
+ gem.email = 'coders@infochimps.com'
11
+ gem.homepage = 'http://infochimps.com/labs'
12
+ gem.licenses = %w[ apachev2 ]
13
+ gem.summary = "Infochimps' lightweight cloud orchestration toolkit, built on top of Chef."
14
+ gem.description = <<-DESC.gsub(/^ {4}/, '').chomp
15
+ Ironfan allows you to orchestrate not just systems, but clusters of machines.
16
+ It includes a powerful layer on top of knife and a collection of cloud cookbooks.
17
+ DESC
18
+ gem.files = `git ls-files`.split($/)
19
+ gem.test_files = gem.files.grep(/^spec/)
20
+ gem.require_paths = %w[ lib ]
21
+
22
+ gem.add_dependency('chef', '10.30.4')
23
+ gem.add_dependency('fog', '1.10.1')
24
+ gem.add_dependency('excon', '0.21.0')
25
+ gem.add_dependency('formatador', '0.2.4')
26
+ gem.add_dependency('gorillib', '0.5.0')
27
+ gem.add_dependency('rbvmomi', '1.8.1')
28
+ gem.add_dependency('diff-lcs', '1.2.5')
29
+ gem.add_dependency('json', '1.5.4')
9
30
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Infochimps"]
12
- s.date = "2014-04-02"
13
- s.description = "Ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
14
- s.email = "coders@infochimps.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.md",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- ".rspec",
22
- ".yardopts",
23
- "CHANGELOG.md",
24
- "ELB.md",
25
- "Gemfile",
26
- "Gemfile.lock",
27
- "Guardfile",
28
- "LICENSE.md",
29
- "README.md",
30
- "Rakefile",
31
- "TODO.md",
32
- "VERSION",
33
- "chefignore",
34
- "config/client.rb",
35
- "config/knife.bash",
36
- "config/knife.bash.README.md",
37
- "config/proxy.pac",
38
- "config/ubuntu10.04-ironfan.erb",
39
- "config/ubuntu12.04-ironfan.erb",
40
- "ironfan.gemspec",
41
- "lib/chef/knife/bootstrap/centos6.2-ironfan.erb",
42
- "lib/chef/knife/bootstrap/chef-full-ironfan.erb",
43
- "lib/chef/knife/bootstrap/rhel6.3-ironfan.erb",
44
- "lib/chef/knife/bootstrap/ubuntu10.04-ironfan.erb",
45
- "lib/chef/knife/bootstrap/ubuntu12.04-ironfan.erb",
46
- "lib/chef/knife/cluster_bootstrap.rb",
47
- "lib/chef/knife/cluster_diff.rb",
48
- "lib/chef/knife/cluster_kick.rb",
49
- "lib/chef/knife/cluster_kill.rb",
50
- "lib/chef/knife/cluster_launch.rb",
51
- "lib/chef/knife/cluster_list.rb",
52
- "lib/chef/knife/cluster_proxy.rb",
53
- "lib/chef/knife/cluster_pry.rb",
54
- "lib/chef/knife/cluster_show.rb",
55
- "lib/chef/knife/cluster_ssh.rb",
56
- "lib/chef/knife/cluster_start.rb",
57
- "lib/chef/knife/cluster_stop.rb",
58
- "lib/chef/knife/cluster_sync.rb",
59
- "lib/chef/knife/environment_from_realm.rb",
60
- "lib/chef/knife/ironfan_knife_common.rb",
61
- "lib/chef/knife/ironfan_script.rb",
62
- "lib/gorillib/diff.rb",
63
- "lib/gorillib/nil_check_delegate.rb",
64
- "lib/gorillib/resolution.rb",
65
- "lib/ironfan.rb",
66
- "lib/ironfan/broker.rb",
67
- "lib/ironfan/broker/computer.rb",
68
- "lib/ironfan/broker/drive.rb",
69
- "lib/ironfan/builder.rb",
70
- "lib/ironfan/deprecated.rb",
71
- "lib/ironfan/dsl.rb",
72
- "lib/ironfan/dsl/cloud.rb",
73
- "lib/ironfan/dsl/cluster.rb",
74
- "lib/ironfan/dsl/component.rb",
75
- "lib/ironfan/dsl/compute.rb",
76
- "lib/ironfan/dsl/ec2.rb",
77
- "lib/ironfan/dsl/facet.rb",
78
- "lib/ironfan/dsl/rds.rb",
79
- "lib/ironfan/dsl/realm.rb",
80
- "lib/ironfan/dsl/role.rb",
81
- "lib/ironfan/dsl/server.rb",
82
- "lib/ironfan/dsl/virtualbox.rb",
83
- "lib/ironfan/dsl/volume.rb",
84
- "lib/ironfan/dsl/vsphere.rb",
85
- "lib/ironfan/headers.rb",
86
- "lib/ironfan/plugin/base.rb",
87
- "lib/ironfan/provider.rb",
88
- "lib/ironfan/provider/chef.rb",
89
- "lib/ironfan/provider/chef/client.rb",
90
- "lib/ironfan/provider/chef/node.rb",
91
- "lib/ironfan/provider/chef/role.rb",
92
- "lib/ironfan/provider/ec2.rb",
93
- "lib/ironfan/provider/ec2/ebs_volume.rb",
94
- "lib/ironfan/provider/ec2/elastic_ip.rb",
95
- "lib/ironfan/provider/ec2/elastic_load_balancer.rb",
96
- "lib/ironfan/provider/ec2/iam_server_certificate.rb",
97
- "lib/ironfan/provider/ec2/keypair.rb",
98
- "lib/ironfan/provider/ec2/machine.rb",
99
- "lib/ironfan/provider/ec2/placement_group.rb",
100
- "lib/ironfan/provider/ec2/security_group.rb",
101
- "lib/ironfan/provider/rds.rb",
102
- "lib/ironfan/provider/rds/machine.rb",
103
- "lib/ironfan/provider/rds/security_group.rb",
104
- "lib/ironfan/provider/virtualbox.rb",
105
- "lib/ironfan/provider/virtualbox/machine.rb",
106
- "lib/ironfan/provider/vsphere.rb",
107
- "lib/ironfan/provider/vsphere/keypair.rb",
108
- "lib/ironfan/provider/vsphere/machine.rb",
109
- "lib/ironfan/requirements.rb",
110
- "notes/Future-development-proposals.md",
111
- "notes/Home.md",
112
- "notes/INSTALL-cloud_setup.md",
113
- "notes/INSTALL.md",
114
- "notes/Ironfan-Roadmap.md",
115
- "notes/Upgrading-to-v4.md",
116
- "notes/advanced-superpowers.md",
117
- "notes/aws_servers.jpg",
118
- "notes/aws_user_key.png",
119
- "notes/cookbook-versioning.md",
120
- "notes/core_concepts.md",
121
- "notes/declaring_volumes.md",
122
- "notes/design_notes-aspect_oriented_devops.md",
123
- "notes/design_notes-ci_testing.md",
124
- "notes/design_notes-cookbook_event_ordering.md",
125
- "notes/design_notes-meta_discovery.md",
126
- "notes/ec2-pricing_and_capacity.md",
127
- "notes/ec2-pricing_and_capacity.numbers",
128
- "notes/homebase-layout.txt",
129
- "notes/knife-cluster-commands.md",
130
- "notes/named-cloud-objects.md",
131
- "notes/opscode_org_key.png",
132
- "notes/opscode_user_key.png",
133
- "notes/philosophy.md",
134
- "notes/rake_tasks.md",
135
- "notes/renamed-recipes.txt",
136
- "notes/silverware.md",
137
- "notes/style_guide.md",
138
- "notes/tips_and_troubleshooting.md",
139
- "notes/walkthrough-hadoop.md",
140
- "notes/walkthrough-web.md",
141
- "spec/chef/cluster_bootstrap_spec.rb",
142
- "spec/chef/cluster_launch_spec.rb",
143
- "spec/fixtures/ec2/elb/snakeoil.crt",
144
- "spec/fixtures/ec2/elb/snakeoil.key",
145
- "spec/fixtures/gunbai.rb",
146
- "spec/fixtures/gunbai_slice.json",
147
- "spec/fixtures/knife/knife.rb",
148
- "spec/integration/minimal-chef-repo/chefignore",
149
- "spec/integration/minimal-chef-repo/environments/_default.json",
150
- "spec/integration/minimal-chef-repo/knife/credentials/knife-org.rb",
151
- "spec/integration/minimal-chef-repo/knife/knife.rb",
152
- "spec/integration/minimal-chef-repo/roles/systemwide.rb",
153
- "spec/integration/spec/elb_build_spec.rb",
154
- "spec/integration/spec/simple_cluster_spec.rb",
155
- "spec/integration/spec_helper.rb",
156
- "spec/integration/spec_helper/launch_cluster.rb",
157
- "spec/ironfan/cluster_spec.rb",
158
- "spec/ironfan/diff_spec.rb",
159
- "spec/ironfan/dsl_spec.rb",
160
- "spec/ironfan/ec2/cloud_provider_spec.rb",
161
- "spec/ironfan/ec2/elb_spec.rb",
162
- "spec/ironfan/ec2/security_group_spec.rb",
163
- "spec/ironfan/manifest_spec.rb",
164
- "spec/ironfan/plugin_spec.rb",
165
- "spec/ironfan/realm_spec.rb",
166
- "spec/spec_helper.rb",
167
- "spec/spec_helper/dummy_chef.rb",
168
- "spec/spec_helper/dummy_diff_drawer.rb",
169
- "spec/test_config.rb",
170
- "tasks/chef_config.rake"
171
- ]
172
- s.homepage = "http://infochimps.com/labs"
173
- s.licenses = ["apachev2"]
174
- s.require_paths = ["lib"]
175
- s.rubygems_version = "1.8.25"
176
- s.summary = "Infochimps' lightweight cloud orchestration toolkit, built on top of Chef."
177
- s.test_files = ["spec/chef/cluster_bootstrap_spec.rb", "spec/chef/cluster_launch_spec.rb", "spec/fixtures/ec2/elb/snakeoil.crt", "spec/fixtures/ec2/elb/snakeoil.key", "spec/fixtures/gunbai.rb", "spec/fixtures/gunbai_slice.json", "spec/fixtures/knife/knife.rb", "spec/integration/minimal-chef-repo/chefignore", "spec/integration/minimal-chef-repo/environments/_default.json", "spec/integration/minimal-chef-repo/knife/credentials/knife-org.rb", "spec/integration/minimal-chef-repo/knife/knife.rb", "spec/integration/minimal-chef-repo/roles/systemwide.rb", "spec/integration/spec/elb_build_spec.rb", "spec/integration/spec/simple_cluster_spec.rb", "spec/integration/spec_helper/launch_cluster.rb", "spec/integration/spec_helper.rb", "spec/ironfan/cluster_spec.rb", "spec/ironfan/diff_spec.rb", "spec/ironfan/dsl_spec.rb", "spec/ironfan/ec2/cloud_provider_spec.rb", "spec/ironfan/ec2/elb_spec.rb", "spec/ironfan/ec2/security_group_spec.rb", "spec/ironfan/manifest_spec.rb", "spec/ironfan/plugin_spec.rb", "spec/ironfan/realm_spec.rb", "spec/spec_helper/dummy_chef.rb", "spec/spec_helper/dummy_diff_drawer.rb", "spec/spec_helper.rb", "spec/test_config.rb"]
31
+ gem.add_development_dependency('bundler', '~> 1.0')
178
32
 
179
- if s.respond_to? :specification_version then
180
- s.specification_version = 3
181
-
182
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
183
- s.add_runtime_dependency(%q<chef>, ["~> 10.16"])
184
- s.add_runtime_dependency(%q<fog>, ["~> 1.2"])
185
- s.add_runtime_dependency(%q<excon>, ["~> 0.21.0"])
186
- s.add_runtime_dependency(%q<formatador>, ["~> 0.2"])
187
- s.add_runtime_dependency(%q<gorillib>, ["~> 0.5.0"])
188
- s.add_runtime_dependency(%q<rbvmomi>, [">= 0"])
189
- s.add_runtime_dependency(%q<diff-lcs>, ["~> 1.2.5"])
190
- s.add_runtime_dependency(%q<json>, ["= 1.5.4"])
191
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
192
- s.add_development_dependency(%q<rake>, [">= 0"])
193
- s.add_development_dependency(%q<rspec>, ["~> 2.8"])
194
- s.add_development_dependency(%q<yard>, [">= 0.7"])
195
- s.add_development_dependency(%q<redcarpet>, [">= 2.1"])
196
- s.add_development_dependency(%q<oj>, [">= 1.2"])
197
- else
198
- s.add_dependency(%q<chef>, ["~> 10.16"])
199
- s.add_dependency(%q<fog>, ["~> 1.2"])
200
- s.add_dependency(%q<excon>, ["~> 0.21.0"])
201
- s.add_dependency(%q<formatador>, ["~> 0.2"])
202
- s.add_dependency(%q<gorillib>, ["~> 0.5.0"])
203
- s.add_dependency(%q<rbvmomi>, [">= 0"])
204
- s.add_dependency(%q<diff-lcs>, ["~> 1.2.5"])
205
- s.add_dependency(%q<json>, ["= 1.5.4"])
206
- s.add_dependency(%q<bundler>, ["~> 1.0"])
207
- s.add_dependency(%q<rake>, [">= 0"])
208
- s.add_dependency(%q<rspec>, ["~> 2.8"])
209
- s.add_dependency(%q<yard>, [">= 0.7"])
210
- s.add_dependency(%q<redcarpet>, [">= 2.1"])
211
- s.add_dependency(%q<oj>, [">= 1.2"])
212
- end
213
- else
214
- s.add_dependency(%q<chef>, ["~> 10.16"])
215
- s.add_dependency(%q<fog>, ["~> 1.2"])
216
- s.add_dependency(%q<excon>, ["~> 0.21.0"])
217
- s.add_dependency(%q<formatador>, ["~> 0.2"])
218
- s.add_dependency(%q<gorillib>, ["~> 0.5.0"])
219
- s.add_dependency(%q<rbvmomi>, [">= 0"])
220
- s.add_dependency(%q<diff-lcs>, ["~> 1.2.5"])
221
- s.add_dependency(%q<json>, ["= 1.5.4"])
222
- s.add_dependency(%q<bundler>, ["~> 1.0"])
223
- s.add_dependency(%q<rake>, [">= 0"])
224
- s.add_dependency(%q<rspec>, ["~> 2.8"])
225
- s.add_dependency(%q<yard>, [">= 0.7"])
226
- s.add_dependency(%q<redcarpet>, [">= 2.1"])
227
- s.add_dependency(%q<oj>, [">= 1.2"])
228
- end
229
33
  end
230
-
@@ -0,0 +1,26 @@
1
+ require 'chef/knife'
2
+ require 'chef/knife/bootstrap'
3
+ require 'chef/knife/ssh'
4
+ require 'gorillib/model/serialization'
5
+ require 'yaml'
6
+
7
+ require 'chef/knife/ironfan_knife_common'
8
+ require 'chef/knife/ironfan_script'
9
+
10
+ class Chef
11
+ class Knife
12
+ autoload :ClusterBootstrap, 'chef/knife/cluster_bootstrap'
13
+ autoload :ClusterDiff, 'chef/knife/cluster_diff'
14
+ autoload :ClusterKick, 'chef/knife/cluster_kick'
15
+ autoload :ClusterKill, 'chef/knife/cluster_kill'
16
+ autoload :ClusterLaunch, 'chef/knife/cluster_launch'
17
+ autoload :ClusterList, 'chef/knife/cluster_list'
18
+ autoload :ClusterProxy, 'chef/knife/cluster_proxy'
19
+ autoload :ClusterPry, 'chef/knife/cluster_pry'
20
+ autoload :ClusterShow, 'chef/knife/cluster_show'
21
+ autoload :ClusterSsh, 'chef/knife/cluster_ssh'
22
+ autoload :ClusterStart, 'chef/knife/cluster_start'
23
+ autoload :ClusterStop, 'chef/knife/cluster_stop'
24
+ autoload :ClusterSync, 'chef/knife/cluster_sync'
25
+ end
26
+ end
@@ -14,6 +14,13 @@ set -e
14
14
 
15
15
  <%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
16
16
 
17
+ echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
18
+
19
+ # Make sure that opscode chef is on the apt repo list.
20
+ sudo mkdir -p /etc/apt/trusted.gpg.d
21
+ gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
22
+ gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
23
+
17
24
  date > /etc/box_build_time
18
25
 
19
26
  echo -e "`date` \n\n**** \n**** apt update:\n****\n"
@@ -15,9 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
20
- require 'chef/knife/bootstrap'
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
@@ -1,8 +1,3 @@
1
- require 'gorillib/model/serialization'
2
- require 'gorillib/nil_check_delegate'
3
- require 'yaml'
4
- require_relative '../../gorillib/diff'
5
-
6
1
  #
7
2
  # Author:: Philip (flip) Kromer (<flip@infochimps.com>)
8
3
  # Copyright:: Copyright (c) 2011 Infochimps, Inc
@@ -20,14 +15,13 @@ require_relative '../../gorillib/diff'
20
15
  # See the License for the specific language governing permissions and
21
16
  # limitations under the License.
22
17
  #
23
-
24
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
25
- require 'yaml'
18
+ require_relative '../cluster_knife'
26
19
 
27
20
  class Chef
28
21
  class Knife
29
22
  class ClusterDiff < Knife
30
23
  include Ironfan::KnifeCommon
24
+
31
25
  deps do
32
26
  Ironfan::KnifeCommon.load_deps
33
27
  end
@@ -15,9 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
20
- require File.expand_path('cluster_ssh', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -15,9 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
20
- require File.expand_path('cluster_bootstrap', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
@@ -48,12 +46,22 @@ class Chef
48
46
  :description => "Perform launch operations even if it may not be safe to do so. Default false",
49
47
  :boolean => true,
50
48
  :default => false
51
-
52
49
  option :bootstrap,
53
50
  :long => "--[no-]bootstrap",
54
51
  :description => "Also bootstrap the launched machine (default is NOT to bootstrap)",
55
52
  :boolean => true,
56
53
  :default => false
54
+ option :cloud,
55
+ long: "--[no-]cloud",
56
+ description: "Look up computers on AWS cloud (default is yes, look up computers; use --no-cloud to skip)",
57
+ default: true,
58
+ boolean: true
59
+
60
+ option :wait_ssh,
61
+ :long => "--[no-]wait-ssh",
62
+ :description => "Wait for the target machine to open an ssh port",
63
+ :boolean => true,
64
+ :default => true
57
65
 
58
66
  def _run
59
67
  load_ironfan
@@ -69,7 +77,7 @@ class Chef
69
77
 
70
78
  warn_or_die_on_bogus_servers(full_target) unless full_target.select(&:bogus?).empty?
71
79
 
72
- die("", "#{ui.color("All computers are running -- not launching any.",:blue)}", "", 1) if target.empty?
80
+ die("", "#{ui.color("All computers are running -- not launching any.",:blue)}", "", 0) if target.empty?
73
81
 
74
82
  # If a bootstrap was requested, ensure that we will be able to perform the
75
83
  # bootstrap *before* trying to launch all of the servers in target. This
@@ -110,10 +118,10 @@ class Chef
110
118
  def perform_after_launch_tasks(computer)
111
119
  # Try SSH
112
120
  unless config[:dry_run]
113
- Ironfan.step(computer.name, 'trying ssh', :white)
114
- # FIXME: This is EC2-specific, abstract it
115
- address = computer.machine.vpc_id.nil? ? computer.machine.public_hostname : computer.machine.public_ip_address
116
- nil until tcp_test_ssh(address){ sleep @initial_sleep_delay ||= 10 }
121
+ if config[:wait_ssh]
122
+ Ironfan.step(computer.name, 'trying ssh', :white)
123
+ nil until wait_for_ssh(computer){ sleep @initial_sleep_delay ||= 10 }
124
+ end
117
125
  end
118
126
 
119
127
  # Run Bootstrap
@@ -123,31 +131,6 @@ class Chef
123
131
  end
124
132
  end
125
133
 
126
- def tcp_test_ssh(target)
127
- tcp_socket = TCPSocket.new(target, 22)
128
- readable = IO.select([tcp_socket], nil, nil, 5)
129
- if readable
130
- Chef::Log.debug("sshd accepting connections on #{target}, banner is #{tcp_socket.gets}")
131
- yield
132
- true
133
- else
134
- false
135
- end
136
- rescue Errno::ETIMEDOUT
137
- Chef::Log.debug("ssh to #{target} timed out")
138
- false
139
- rescue Errno::ECONNREFUSED
140
- Chef::Log.debug("ssh connection to #{target} refused")
141
- sleep 2
142
- false
143
- rescue Errno::EHOSTUNREACH
144
- Chef::Log.debug("ssh host #{target} unreachable")
145
- sleep 2
146
- false
147
- ensure
148
- tcp_socket && tcp_socket.close
149
- end
150
-
151
134
  def warn_or_die_on_bogus_servers(target)
152
135
  ui.info("")
153
136
  ui.info "Cluster has servers in a transitional or undefined state (shown as 'bogus'):"
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -39,19 +38,21 @@ class Chef
39
38
  def _run
40
39
  load_ironfan
41
40
  configure_dry_run
42
- Ironfan.load_cluster_files
41
+ Ironfan.dsl_files(Ironfan.clusters_dir).each{ |f| Ironfan.load_dsl_file f }
43
42
 
44
43
  data = Ironfan.clusters.values.map do |cluster|
45
44
  name, path = [cluster.name, cluster.source_file]
46
45
  as_table = { :cluster => name, :path => path }
47
46
  if config[:facets]
48
- facets = Ironfan.load_cluster(name).facets.to_a.map(&:name).join(', ')
47
+ facets = Ironfan.load_cluster(name).facets.to_a.map do |facet|
48
+ "#{facet.name}(#{facet.instances})"
49
+ end.join(', ')
49
50
  as_table.merge!(:facets => facets)
50
51
  end
51
52
  as_table
52
53
  end
53
54
 
54
- ui.info "Cluster Path: #{ Ironfan.cluster_path.join ", " }"
55
+ ui.info "Cluster Path: #{ Ironfan.clusters_dir.join ", " }"
55
56
  headers = config[:facets] ? [:cluster, :facets, :path] : [:cluster, :path]
56
57
  Formatador.display_compact_table(data, headers)
57
58
  end
@@ -15,9 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
20
- require File.expand_path('cluster_ssh', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -15,14 +15,13 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
20
- require 'yaml'
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
24
22
  class ClusterShow < Knife
25
23
  include Ironfan::KnifeCommon
24
+
26
25
  deps do
27
26
  Ironfan::KnifeCommon.load_deps
28
27
  end
@@ -30,10 +29,10 @@ class Chef
30
29
  banner "knife cluster show CLUSTER[-FACET[-INDEXES]] (options) - a helpful display of cluster's cloud and chef state"
31
30
 
32
31
  option :cloud,
33
- :long => "--[no-]cloud",
34
- :description => "Look up computers on AWS cloud (default is yes, look up computers; use --no-cloud to skip)",
35
- :default => true,
36
- :boolean => true
32
+ long: "--[no-]cloud",
33
+ description: "Look up computers on AWS cloud (default is yes, look up computers; use --no-cloud to skip)",
34
+ default: true,
35
+ boolean: true
37
36
 
38
37
  def _run
39
38
  with_verbosity(1){ config[:include_terminated] = true }
@@ -15,9 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_knife_common', File.dirname(File.realdirpath(__FILE__)))
20
- require 'chef/knife/ssh'
18
+ require_relative '../cluster_knife'
21
19
 
22
20
  class Chef
23
21
  class Knife
@@ -53,13 +51,17 @@ class Chef
53
51
 
54
52
  (ui.fatal("No nodes returned from search!"); exit 10) if addresses.nil? || addresses.length == 0
55
53
 
56
- @hostname_to_ironfan_hostname = Hash[
57
- target.map do |c|
58
- [c.machine.public_hostname, c.machine.tags['Name']]
59
- end
60
- ]
54
+ # Need to include both public host and public ip; sometimes these are different
55
+ @hostname_to_ironfan_hostname = target.to_a.inject({}) do |remap, c|
56
+ remap[c.machine.public_hostname] = c.machine.tags['Name'] || c.name
57
+ remap[c.machine.public_ip_address] = c.machine.tags['Name'] || c.name
58
+ remap
59
+ end
60
+
61
61
  @longest_ironfan_hostname = @hostname_to_ironfan_hostname.values.group_by(&:size).max.last[0].size
62
62
 
63
+ @action_nodes = Chef::Search::Query.new.search(:node, "node_name:#{@name_args[0]}*")[0]
64
+
63
65
  session_from_list(addresses)
64
66
  end
65
67
 
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -15,8 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
-
19
- require File.expand_path('ironfan_script', File.dirname(File.realdirpath(__FILE__)))
18
+ require_relative '../cluster_knife'
20
19
 
21
20
  class Chef
22
21
  class Knife
@@ -46,7 +45,7 @@ class Chef
46
45
  computer.created? or computer.node?
47
46
  end
48
47
 
49
- def perform_execution(target)
48
+ def perform_execution target
50
49
  if config[:chef]
51
50
  if config[:dry_run]
52
51
  ui.info "(can't do a dry-run when syncing to chef -- skipping)"