Class: Cucumber::Chef::TestLab
- Inherits:
-
Object
- Object
- Cucumber::Chef::TestLab
show all
- Defined in:
- lib/cucumber/chef/test_lab.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(ui = ZTK::UI.new) ⇒ TestLab
Returns a new instance of TestLab.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *method_args) ⇒ Object
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/cucumber/chef/test_lab.rb', line 106
def method_missing(method_name, *method_args)
if Cucumber::Chef::Provider::PROXY_METHODS.include?(method_name.to_s)
result = @provider.send(method_name.to_sym, *method_args)
splat = [method_name, *method_args].flatten.compact
@ui.logger.debug { "TestLab: #{splat.inspect}=#{result.inspect}" }
result
else
super(method_name, *method_args)
end
end
|
Instance Attribute Details
#containers ⇒ Object
Returns the value of attribute containers.
28
29
30
|
# File 'lib/cucumber/chef/test_lab.rb', line 28
def containers
@containers
end
|
#provider ⇒ Object
Returns the value of attribute provider.
28
29
30
|
# File 'lib/cucumber/chef/test_lab.rb', line 28
def provider
@provider
end
|
Instance Method Details
#bootstrap_ssh(options = {}) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/cucumber/chef/test_lab.rb', line 41
def bootstrap_ssh(options={})
if (!defined?(@bootstrap_ssh) || @bootstrap_ssh.nil?)
@bootstrap_ssh ||= ZTK::SSH.new({:ui => @ui, :timeout => Cucumber::Chef::Config.command_timeout}.merge(options))
@bootstrap_ssh.config.host_name = self.ip
@bootstrap_ssh.config.port = self.port
@bootstrap_ssh.config.user = Cucumber::Chef.bootstrap_user
@bootstrap_ssh.config.keys = Cucumber::Chef.bootstrap_identity
end
@bootstrap_ssh
end
|
#knife_cli(args, options = {}) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/cucumber/chef/test_lab.rb', line 89
def knife_cli(args, options={})
options = {:silence => true}.merge(options)
arguments = Array.new
arguments << "--user #{Cucumber::Chef::Config.user}"
arguments << "--key #{Cucumber::Chef.chef_identity}"
arguments << "--server-url https://#{self.ip}"
arguments << "--disable-editing"
arguments << "--yes"
arguments << "-VV" if Cucumber::Chef.is_rc?
command = Cucumber::Chef.build_command("knife", args, arguments)
ZTK::Command.new.exec(command, options)
end
|
#proxy_ssh(container, options = {}) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/cucumber/chef/test_lab.rb', line 69
def proxy_ssh(container, options={})
container = container.to_sym
@proxy_ssh ||= Hash.new
if (!defined?(@proxy_ssh[container]) || @proxy_ssh[container].nil?)
@proxy_ssh[container] ||= ZTK::SSH.new({:ui => @ui, :timeout => Cucumber::Chef::Config.command_timeout}.merge(options))
@proxy_ssh[container].config.proxy_host_name = self.ip
@proxy_ssh[container].config.proxy_port = Cucumber::Chef.lab_ssh_port || self.port
@proxy_ssh[container].config.proxy_user = Cucumber::Chef.lab_user
@proxy_ssh[container].config.proxy_keys = Cucumber::Chef.lab_identity
@proxy_ssh[container].config.host_name = container
@proxy_ssh[container].config.user = Cucumber::Chef.lxc_user
@proxy_ssh[container].config.keys = Cucumber::Chef.lxc_identity
end
@proxy_ssh[container]
end
|
#ssh(options = {}) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/cucumber/chef/test_lab.rb', line 55
def ssh(options={})
if (!defined?(@ssh) || @ssh.nil?)
@ssh ||= ZTK::SSH.new({:ui => @ui, :timeout => Cucumber::Chef::Config.command_timeout}.merge(options))
@ssh.config.host_name = self.ip
@ssh.config.port = self.port
@ssh.config.user = Cucumber::Chef.lab_user
@ssh.config.keys = Cucumber::Chef.lab_identity
end
@ssh
end
|