Class: Cucumber::Chef::Provider
- Inherits:
-
Object
- Object
- Cucumber::Chef::Provider
show all
- Defined in:
- lib/cucumber/chef/provider.rb,
lib/cucumber/chef/providers/aws.rb,
lib/cucumber/chef/providers/vagrant.rb
Defined Under Namespace
Classes: AWS, AWSError, Vagrant, VagrantError
Constant Summary
collapse
- PROXY_METHODS =
%w(create destroy up down reload status id state username ip port alive? dead? exists?)
Instance Method Summary
collapse
Constructor Details
#initialize(ui = ZTK::UI.new) ⇒ Provider
Returns a new instance of Provider.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *method_args) ⇒ Object
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/cucumber/chef/provider.rb', line 84
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 { "Provider: #{splat.inspect}=#{result.inspect}" }
result
else
super(method_name, *method_args)
end
end
|
Instance Method Details
#ip ⇒ Object
74
75
76
|
# File 'lib/cucumber/chef/provider.rb', line 74
def ip
(Cucumber::Chef.lab_ip || @provider.ip)
end
|
#status ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/cucumber/chef/provider.rb', line 47
def status
if exists?
= %w(provider id state username ip_address ssh_port).map(&:to_sym)
results = ZTK::Report.new.list([nil], ) do |noop|
OpenStruct.new(
:provider => @provider.class,
:id => self.id,
:state => self.state,
:username => self.username,
:ip_address => self.ip,
:ssh_port => self.port
)
end
else
raise ProviderError, "No test labs exists!"
end
rescue Exception => e
@ui.logger.fatal { e.message }
@ui.logger.fatal { e.backtrace.join("\n") }
raise ProviderError, e.message
end
|