cucumber-chef 2.1.0.rc.2 → 2.1.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/cc-knife CHANGED
@@ -2,15 +2,14 @@
2
2
  require 'cucumber-chef'
3
3
 
4
4
  # if we have bundler binstubs use that; otherwise attempt to detect
5
- knife = (Cucumber::Chef.locate(:file, "bin", "knife") rescue nil)
6
- knife = "/usr/bin/env knife" unless knife
5
+ knife = (Cucumber::Chef.locate(:file, "bin", "knife") rescue "/usr/bin/env knife")
7
6
 
8
7
  message = "cc-knife v#{Cucumber::Chef::VERSION}"
9
8
  puts(message)
10
9
  Cucumber::Chef.logger.info { message }
11
10
 
12
11
  Cucumber::Chef::Config.load
13
- if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
12
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
14
13
 
15
14
  knife_rb = Cucumber::Chef.knife_rb
16
15
  if File.exists?(knife_rb)
data/bin/cc-push CHANGED
@@ -1,22 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'cucumber-chef'
3
3
 
4
- def run_remote(command)
5
- $logger.info { "cc-push(run_remote): '#{command}'" }
6
- $test_lab.ssh.exec(command)
7
- end
8
-
9
- def run_local(command)
10
- $logger.info { "cc-push(run_local): '#{command}'" }
11
- %x(#{command})
12
- end
13
-
14
4
  tag = Cucumber::Chef.tag("cc-push")
15
5
  puts(tag)
16
6
  Cucumber::Chef.boot(tag)
17
7
  $logger = Cucumber::Chef.logger
18
8
 
19
- if ($test_lab = Cucumber::Chef::TestLab.new) && ($test_lab.labs_running.count > 0)
9
+ if ($test_lab = Cucumber::Chef::TestLab.new) && $test_lab.alive?
20
10
  gem_name = "cucumber-chef-#{Cucumber::Chef::VERSION}.gem"
21
11
  gem_path = File.join(Cucumber::Chef.root_dir, gem_name)
22
12
 
@@ -37,21 +27,23 @@ if ($test_lab = Cucumber::Chef::TestLab.new) && ($test_lab.labs_running.count >
37
27
  $test_lab.ssh.upload(local_file, remote_file)
38
28
  FileUtils.rm_f(File.join(Cucumber::Chef.root_dir, "*.gem"))
39
29
 
40
- run_remote(<<-EOH
30
+ $test_lab.ssh.exec(<<-EOH
41
31
  sudo /bin/bash -c '
32
+ pkill -9 cc-server
42
33
  cd #{File.dirname(remote_file)}
43
34
  ls -la | grep 'cucumber-chef-'
44
- gem uninstall cucumber-chef --all --ignore-dependencies --executables --backtrace
35
+ gem uninstall cucumber-chef ztk --all --ignore-dependencies --executables --backtrace
45
36
  rm -fv /usr/lib/ruby/gems/1.8/cache/#{gem_name}
46
37
  gem cleanup cucumber-chef --backtrace
47
38
  gem install #{remote_file} --backtrace
48
- rm -fv /home/#{$test_lab.ssh.config.user}/*.gem'
39
+ rm -fv /home/#{$test_lab.ssh.config.user}/*.gem
40
+ exit 0'
49
41
  EOH
50
42
  )
51
43
  File.exists?(gem_path) && File.delete(gem_path)
52
44
  end
53
45
 
54
46
  else
55
- puts("No run_remotening cucumber-chef test labs to connect to!")
47
+ puts("No running cucumber-chef test labs to connect to!")
56
48
  exit(1)
57
49
  end
data/bin/cc-server CHANGED
@@ -18,31 +18,62 @@ require 'drb/acl'
18
18
  require 'cucumber-chef'
19
19
  require 'cucumber/chef/helpers'
20
20
 
21
+ tag = Cucumber::Chef.tag("cc-server")
22
+ puts(" * #{tag}")
23
+ Cucumber::Chef.boot(tag)
24
+ $logger = Cucumber::Chef.logger
25
+ Dir.chdir(File.join("/home", Cucumber::Chef.lab_user))
26
+
21
27
  class FrontObject
22
- attr_accessor :servers
28
+ attr_accessor :containers
23
29
 
24
30
  include Cucumber::Chef
25
31
  include Cucumber::Chef::Helpers
26
32
 
33
+ ################################################################################
34
+
27
35
  def initialize
28
- tag = Cucumber::Chef.tag("cc-server")
29
- puts(" * #{tag}")
30
- Cucumber::Chef.boot(tag)
31
- $logger = Cucumber::Chef.logger
32
- Dir.chdir(File.join("/home", Cucumber::Chef.lab_user))
36
+ logger.info { "DRB=#{DRb.config.inspect}" }
37
+
38
+ if ENV['PURGE']
39
+ Cucumber::Chef.logger.warn { "PURGING CONTAINERS! Container attributes will be reset!" }
40
+ load_containers
41
+ containers.each do |name, value|
42
+ server_destroy(name)
43
+ end
44
+
45
+ File.exists?(Cucumber::Chef.containers_bin) && File.delete(Cucumber::Chef.containers_bin)
46
+ load_containers
47
+ else
48
+ Cucumber::Chef.logger.info { "Allowing existing containers to persist." }
49
+ end
33
50
  end
34
51
 
52
+ ################################################################################
53
+
35
54
  def shutdown
55
+ logger.fatal { "Shutting down." }
36
56
  DRb.stop_service
57
+ exit(0)
37
58
  end
38
59
 
60
+ ################################################################################
61
+
39
62
  def logger
40
63
  $logger
41
64
  end
42
65
 
66
+ ################################################################################
67
+
68
+ def ping
69
+ "pong"
70
+ end
71
+
72
+ ################################################################################
73
+
43
74
  end
44
75
 
45
- list = %w( deny all )
76
+ list = %w(deny all)
46
77
  ARGV[0] and (list += [ 'allow', ARGV[0] ])
47
78
  acl = ACL.new(list)
48
79
 
data/bin/cucumber-chef CHANGED
@@ -132,7 +132,6 @@ class CucumberChef < Thor
132
132
  def setup
133
133
  boot
134
134
 
135
- puts
136
135
  if (test_lab = Cucumber::Chef::TestLab.new)
137
136
  if (provider = test_lab.create)
138
137
  if (provisioner = Cucumber::Chef::Provisioner.new(test_lab))
@@ -140,16 +139,11 @@ class CucumberChef < Thor
140
139
  provisioner.build
141
140
 
142
141
  puts
143
- puts("Your cucumber-chef test lab has now been provisioned!")
142
+ puts("If you are using AWS, be sure to log into the chef-server webui and change the default admin password at least.")
144
143
  puts
145
- puts("Be sure to log into the chef-server webui and change the default credentials.")
144
+ puts("Your test lab has now been provisioned! Enjoy!")
146
145
  puts
147
- puts(" Chef-Server WebUI:")
148
- puts(" http://#{test_lab.ip}:4040/")
149
- puts(" Username:")
150
- puts(" admin")
151
- puts(" Password:")
152
- puts(" #{Cucumber::Chef::Provisioner::PASSWORD}")
146
+ test_lab.status
153
147
 
154
148
  else
155
149
  puts(set_color("Could not create the provisioner!", :red, true))
@@ -168,64 +162,70 @@ class CucumberChef < Thor
168
162
  end
169
163
 
170
164
  ################################################################################
171
- # TEARDOWN
165
+ # DESTROY
172
166
  ################################################################################
173
167
 
174
- desc "teardown [container]", "Teardown the cucumber-chef test lab in Amazon EC2 or a test lab [container] if specified."
168
+ desc "destroy [container]", "Destroy the cucumber-chef test lab in Amazon EC2 or a test lab [container] if specified."
175
169
  method_option :test, :type => :boolean, :desc => "INTERNAL USE ONLY"
176
- def teardown(*args)
170
+ def destroy(*args)
177
171
  boot
178
172
 
179
- puts
180
- if (test_lab = Cucumber::Chef::TestLab.new)
173
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.exists?
181
174
  if args.count == 0
182
- if yes?(set_color("Are you sure you want to teardown your cucumber-chef test lab?", :red, true))
183
- count_down_colors = { 5 => :green, 4 => :yellow, 3 => :yellow, 2 => :red, 1 => :red }
175
+ test_lab.status
176
+
177
+ if yes?(set_color("Are you sure you want to destroy the test lab?", :red, true))
184
178
  puts
185
- puts(set_color("You have 5 seconds to abort!", :green, true))
179
+ puts(set_color("You have 5 seconds to abort!", :red, true))
186
180
  puts
187
- print(set_color("Self-destructing in", :green, true))
188
181
  5.downto(1) do |x|
189
- print(set_color("...#{x}", count_down_colors[x], true))
182
+ print("#{x}...")
190
183
  sleep(1)
191
184
  end
192
- puts(set_color("...BOOM!", :red, true))
185
+ puts("BOOM!")
193
186
  puts
194
- test_lab.destroy
187
+
188
+ ZTK::Benchmark.bench(:message => "Destroy #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do
189
+ test_lab.destroy
190
+ end
195
191
  else
196
192
  puts
197
193
  puts(set_color("Whew! That was close!", :green, true))
198
194
  end
199
195
  else
200
- container = args[0]
201
- if yes?(set_color("Are you sure you want to teardown the test lab containter '#{container}'?", :red, true))
202
- count_down_colors = { 5 => :green, 4 => :yellow, 3 => :yellow, 2 => :red, 1 => :red }
196
+ if yes?(set_color("Are you sure you want to destroy the container#{args.count > 1 ? 's' : nil} #{args.collect{|a| "'#{a}'"}.join(', ')}?", :red, true))
203
197
  puts
204
- puts(set_color("You have 5 seconds to abort!", :green, true))
198
+ puts(set_color("You have 5 seconds to abort!", :red, true))
205
199
  puts
206
- print(set_color("Self-destructing in", :green, true))
207
200
  5.downto(1) do |x|
208
- print(set_color("...#{x}", count_down_colors[x], true))
201
+ print("#{x}...")
209
202
  sleep(1)
210
203
  end
211
- puts(set_color("...BOOM!", :red, true))
204
+ puts("BOOM!")
212
205
  puts
213
206
 
214
- test_lab.ssh.exec("nohup sudo pkill -9 -f cc-server")
215
- test_lab.ssh.exec("nohup sudo BACKGROUND=yes cc-server #{Cucumber::Chef.external_ip}")
216
- Cucumber::Chef.spinner do
217
- ZTK::TCPSocketCheck.new(:host => test_lab.ip, :port => 8787, :data => "\n\n").wait
207
+ ZTK::Benchmark.bench(:message => "Start cc-server", :mark => "completed in %0.4f seconds.") do
208
+ cc_server = Cucumber::Chef::Server.new(test_lab)
209
+ cc_server.up(:silence => true)
210
+ end
211
+
212
+ args.each do |container|
213
+ ZTK::Benchmark.bench(:message => "Destroy container '#{container}'", :mark => "completed in %0.4f seconds.") do
214
+ test_lab.drb.load_containers
215
+ test_lab.drb.server_destroy(container)
216
+ test_lab.drb.server_delete(container)
217
+ test_lab.drb.save_containers
218
+ end
218
219
  end
219
- test_lab.drb.servers = Hash.new(nil)
220
- test_lab.drb.server_destroy(container)
221
220
  else
222
221
  puts
223
222
  puts(set_color("Whew! That was close!", :green, true))
224
223
  end
224
+
225
225
  end
226
226
 
227
227
  else
228
- puts(set_color("Could not find a cucumber-chef test lab to teardown!", :red, true))
228
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
229
229
  end
230
230
  puts
231
231
 
@@ -242,11 +242,12 @@ class CucumberChef < Thor
242
242
  def up
243
243
  boot
244
244
 
245
- puts
246
- if (test_lab = Cucumber::Chef::TestLab.new)
247
- test_lab.up
245
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.dead?
246
+ ZTK::Benchmark.bench(:message => "Booting #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do
247
+ test_lab.up
248
+ end
248
249
  else
249
- puts(set_color("Could not find a cucumber-chef test lab to startup!", :red, true))
250
+ raise Cucumber::Chef::Error, "We could not find a powered off test lab."
250
251
  end
251
252
  puts
252
253
 
@@ -256,18 +257,41 @@ class CucumberChef < Thor
256
257
  end
257
258
 
258
259
  ################################################################################
259
- # DOWN
260
+ # HALT
260
261
  ################################################################################
261
262
 
262
- desc "down", "Shutdown the cucumber-chef test lab"
263
- def down
263
+ desc "halt", "Power off the cucumber-chef test lab"
264
+ def halt
264
265
  boot
265
266
 
267
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
268
+ ZTK::Benchmark.bench(:message => "Halting #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do
269
+ test_lab.halt
270
+ end
271
+ else
272
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
273
+ end
266
274
  puts
267
- if (test_lab = Cucumber::Chef::TestLab.new)
268
- test_lab.down
275
+
276
+ rescue Cucumber::Chef::Error => e
277
+ $logger.fatal { e.backtrace.join("\n") }
278
+ fatal(e)
279
+ end
280
+
281
+ ################################################################################
282
+ # RELOAD
283
+ ################################################################################
284
+
285
+ desc "reload", "Reload the cucumber-chef test lab"
286
+ def reload
287
+ boot
288
+
289
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
290
+ ZTK::Benchmark.bench(:message => "Reloading #{Cucumber::Chef::Config.provider.upcase} instance '#{test_lab.id}'", :mark => "completed in %0.4f seconds.") do
291
+ test_lab.reload
292
+ end
269
293
  else
270
- puts(set_color("Could not find a cucumber-chef test lab to shutdown!", :red, true))
294
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
271
295
  end
272
296
  puts
273
297
 
@@ -281,13 +305,60 @@ class CucumberChef < Thor
281
305
  ################################################################################
282
306
 
283
307
  desc "status", "Displays the current status of the test lab."
308
+ method_option :containers, :type => :boolean, :desc => "Display container status.", :default => false
309
+ method_option :attributes, :type => :boolean, :desc => "Display chef-client attributes for containers.", :default => false
284
310
  method_option :test, :type => :boolean, :desc => "INTERNAL USE ONLY"
285
311
  def status
286
312
  boot
287
313
 
288
- puts
289
314
  if (test_lab = Cucumber::Chef::TestLab.new)
290
- test_lab.status
315
+ if @options.containers?
316
+ if test_lab.alive?
317
+ ZTK::Benchmark.bench(:message => "Start cc-server", :mark => "completed in %0.4f seconds.") do
318
+ test_lab.cc_server.up(:silence => true)
319
+ end
320
+
321
+ test_lab.drb.load_containers
322
+
323
+ headers = [:name, :alive, :arch, :distro, :ip, :mac, :"chef version", :persist]
324
+ results = ZTK::Report.new.spreadsheet(test_lab.drb.containers, headers) do |name, detail|
325
+ chef_version = "N/A"
326
+ alive = (test_lab.drb.command_run_local(%Q{ping -n -c 1 -W 1 #{detail[:ip]}}, :ignore_exit_status => true).exit_code == 0)
327
+ if alive
328
+ chef_version = test_lab.drb.command_run_chroot(name, %Q{/usr/bin/env chef-client -v}, :ignore_exit_status => true).output.chomp
329
+ end
330
+
331
+ OpenStruct.new(
332
+ :name => name,
333
+ :ip => detail[:ip],
334
+ :mac => detail[:mac],
335
+ :distro => detail[:distro],
336
+ :arch => detail[:arch],
337
+ :alive => alive,
338
+ :"chef version" => chef_version,
339
+ :persist => detail[:persist],
340
+ :chef_attributes => detail[:chef_client]
341
+ )
342
+ end
343
+
344
+ if @options.attributes?
345
+ results.rows.each do |result|
346
+ puts
347
+ puts("-" * results.width)
348
+ puts("Chef-Client attributes for '#{result.name.to_s.downcase}':")
349
+ puts("-" * results.width)
350
+ puts(JSON.pretty_generate(result.chef_attributes))
351
+ end
352
+ end
353
+
354
+ test_lab.cc_server.down
355
+ else
356
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
357
+ end
358
+
359
+ else
360
+ test_lab.status
361
+ end
291
362
  end
292
363
  puts
293
364
 
@@ -301,23 +372,48 @@ class CucumberChef < Thor
301
372
  ################################################################################
302
373
 
303
374
  desc "ssh [container]", "SSH to cucumber-chef test lab or [container] if specified."
304
- method_option :test, :type => :boolean, :desc => "INTERNAL USE ONLY"
375
+ method_option :bootstrap, :type => :boolean, :desc => "Use the bootstrap settings.", :default => false
305
376
  def ssh(*args)
306
377
  boot
307
378
 
308
- puts
309
- if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
310
- if args.size == 0
311
- puts([set_color("Attempting SSH connection to cucumber-chef '", :blue, true), set_color("test lab", :cyan, true), set_color("'...", :blue, true)].join)
379
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
380
+ if @options.bootstrap?
381
+ puts([set_color("Attempting bootstrap SSH connection to cucumber-chef '", :blue, true), set_color("test lab", :cyan, true), set_color("'...", :blue, true)].join)
382
+ test_lab.bootstrap_ssh.console
383
+ elsif args.size == 0
384
+ puts([set_color("Attempting SSH connection to the '", :blue, true), set_color("test lab", :cyan, true), set_color("'...", :blue, true)].join)
312
385
  test_lab.ssh.console
313
- else
386
+ elsif args.size > 0
314
387
  container = args[0]
315
- puts([set_color("Attempting SSH connection to cucumber-chef container '", :blue, true), set_color(container, :cyan, true), set_color("'...", :blue, true)].join)
388
+ puts([set_color("Attempting proxy SSH connection to the container '", :blue, true), set_color(container, :cyan, true), set_color("'...", :blue, true)].join)
316
389
  test_lab.proxy_ssh(container).console
390
+ else
391
+ raise Cucumber::Chef::Error, "You did not specify a valid combination of options."
317
392
  end
393
+ else
394
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
395
+ end
396
+ puts
397
+
398
+ rescue Cucumber::Chef::Error => e
399
+ $logger.fatal { e.backtrace.join("\n") }
400
+ fatal(e)
401
+ end
318
402
 
403
+ ################################################################################
404
+ # PS
405
+ ################################################################################
406
+
407
+ desc "ps [ps-options]", "Snapshot of the current cucumber-chef test lab container processes."
408
+ def ps(*args)
409
+ boot
410
+
411
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
412
+ puts("-" * 80)
413
+ test_lab.ssh.exec("lxc-ps --lxc -- #{args.join(" ")}")
414
+ puts("-" * 80)
319
415
  else
320
- puts(set_color("No cucumber-chef test labs available to ssh to!", :red, true))
416
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
321
417
  end
322
418
  puts
323
419
 
@@ -334,13 +430,9 @@ class CucumberChef < Thor
334
430
  def log
335
431
  boot
336
432
 
337
- if ($test_lab = Cucumber::Chef::TestLab.new) && ($test_lab.labs_running.count > 0)
433
+ if ($test_lab = Cucumber::Chef::TestLab.new) && $test_lab.exists? && $test_lab.alive?
338
434
  $tail_thread_remote = Thread.new do
339
435
  $test_lab.ssh.exec("tail -n 0 -f /home/#{$test_lab.ssh.config.user}/.cucumber-chef/cucumber-chef.log")
340
-
341
- Kernel.at_exit do
342
- $test_lab.ssh.close
343
- end
344
436
  end
345
437
 
346
438
  log_file = File.open(Cucumber::Chef.log_file, "r")
@@ -354,11 +446,13 @@ class CucumberChef < Thor
354
446
  end
355
447
 
356
448
  $tail_thread_remote.join
449
+ else
450
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
357
451
  end
358
452
 
359
- Kernel.at_exit do
360
- $tail_thread_remote.kill
361
- end
453
+ rescue Cucumber::Chef::Error => e
454
+ $logger.fatal { e.backtrace.join("\n") }
455
+ fatal(e)
362
456
  end
363
457
 
364
458
  ################################################################################
@@ -372,8 +466,7 @@ class CucumberChef < Thor
372
466
  def diagnose(container)
373
467
  boot
374
468
 
375
- puts
376
- if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
469
+ if (test_lab = Cucumber::Chef::TestLab.new) && test_lab.alive?
377
470
  puts([set_color("Attempting to collect diagnostic information on cucumber-chef container '", :blue, true), set_color(container, :cyan, true), set_color("'...", :blue, true)].join)
378
471
  if @options.strace?
379
472
  puts
@@ -388,6 +481,8 @@ class CucumberChef < Thor
388
481
  puts(set_color("============================================================================", :bold))
389
482
  test_lab.proxy_ssh(container).exec("[[ -e /var/log/chef/client.log ]] && tail -n #{@options.lines} /var/log/chef/client.log")
390
483
  end
484
+ else
485
+ raise Cucumber::Chef::Error, "We could not find a running test lab."
391
486
  end
392
487
  puts
393
488
 
@@ -410,7 +505,7 @@ class CucumberChef < Thor
410
505
  "home_dir" => Cucumber::Chef.home_dir,
411
506
  "log_file" => Cucumber::Chef.log_file,
412
507
  "config_rb" => Cucumber::Chef.config_rb,
413
- "servers_bin" => Cucumber::Chef.servers_bin,
508
+ "containers_bin" => Cucumber::Chef.containers_bin,
414
509
  "knife_rb" => Cucumber::Chef.knife_rb,
415
510
  "chef_repo" => Cucumber::Chef.chef_repo,
416
511
  "bootstrap_identity" => Cucumber::Chef.bootstrap_identity,
@@ -421,16 +516,15 @@ class CucumberChef < Thor
421
516
  "lxc_user_home_dir" => Cucumber::Chef.lxc_user_home_dir,
422
517
  "lxc_identity" => Cucumber::Chef.lxc_identity
423
518
  }
519
+ max_key_length = details.collect{ |k,v| k.to_s.length }.max
424
520
 
425
- puts
426
-
521
+ puts("-" * 80)
427
522
  say(Cucumber::Chef::Config.configuration.to_yaml, :bold)
428
-
429
- max_key_length = details.collect{ |k,v| k.to_s.length }.max
523
+ puts("-" * 80)
430
524
  details.each do |key,value|
431
525
  puts("%#{max_key_length}s = %s" % [key.downcase, value.inspect])
432
526
  end
433
-
527
+ puts("-" * 80)
434
528
  puts
435
529
 
436
530
  rescue Cucumber::Chef::Error => e
@@ -438,29 +532,6 @@ class CucumberChef < Thor
438
532
  fatal(e.message)
439
533
  end
440
534
 
441
- ################################################################################
442
- # PS
443
- ################################################################################
444
-
445
- desc "ps [ps-options]", "Snapshot of the current cucumber-chef test lab container processes."
446
- def ps(*args)
447
- boot
448
-
449
- puts
450
- if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
451
- puts(set_color("Getting container processes from cucumber-chef test lab...", :blue, true))
452
- puts
453
- puts(set_color("============================================================================", :bold))
454
- test_lab.ssh.exec("lxc-ps --lxc -- #{args.join(" ")}")
455
- print("\n")
456
- end
457
- puts
458
-
459
- rescue Cucumber::Chef::Error => e
460
- $logger.fatal { e.backtrace.join("\n") }
461
- fatal(e)
462
- end
463
-
464
535
  ################################################################################
465
536
  # CREATE
466
537
  ################################################################################
@@ -485,34 +556,23 @@ class CucumberChef < Thor
485
556
  end
486
557
 
487
558
  ################################################################################
488
- # DEPRECIATED: INFO
489
- ################################################################################
490
-
491
- desc "info", "DEPRECIATED! - You should execute the 'status' task instead."
492
- def info
493
- puts
494
- puts(set_color("The 'info' task is DEPRECIATED! You should execute the 'status' task instead.", :red, true))
495
- puts
496
- status
497
-
498
- rescue Cucumber::Chef::Error => e
499
- $logger.fatal { e.backtrace.join("\n") }
500
- fatal(e)
501
- end
502
-
503
- ################################################################################
504
- # DEPRECIATED: TEST
559
+ # DEPRECIATED TASKS
505
560
  ################################################################################
506
561
 
507
- desc "test", "DEPRECIATED! - You should execute 'cucumber' or 'rspec' directly."
508
- def test
509
- puts
510
- puts(set_color("The test task is DEPRECIATED! You should execute 'cucumber' or 'rspec' directly.", :red, true))
511
- puts
562
+ depreciated_tasks = {
563
+ "teardown" => "You should execute the 'destroy' task instead.",
564
+ "info" => "You should execute the 'status' task instead.",
565
+ "test" => "You should execute 'cucumber' or 'rspec' directly.",
566
+ "down" => "You should execute the 'halt' task instead."
567
+ }
512
568
 
513
- rescue Cucumber::Chef::Error => e
514
- $logger.fatal { e.backtrace.join("\n") }
515
- fatal(e)
569
+ depreciated_tasks.each do |old_task, message|
570
+ desc old_task, "*DEPRECIATED* - #{message}"
571
+ define_method(old_task) do
572
+ puts
573
+ puts(set_color("The '#{old_task}' task is *DEPRECIATED* - #{message}", :red, true))
574
+ puts
575
+ end
516
576
  end
517
577
 
518
578
  ################################################################################