2014-05-08 15:34:26 +04:00
|
|
|
require "fog"
|
|
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
module Provider
|
|
|
|
|
class BaseProvider
|
2014-05-08 15:34:26 +04:00
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
attr_accessor :ssh_key, :certificate_path, :connection_options
|
2014-05-08 15:34:26 +04:00
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
protected
|
|
|
|
|
def connection_compute options
|
|
|
|
|
Fog::Compute.new( options )
|
|
|
|
|
end
|
2014-05-08 15:34:26 +04:00
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
def connection_network options
|
|
|
|
|
Fog::Network.new( options )
|
|
|
|
|
end
|
2014-05-08 15:34:26 +04:00
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
def configured?
|
|
|
|
|
!(empty_param?(self.ssh_key) or empty_param?(self.certificate_path))
|
|
|
|
|
end
|
2014-05-08 15:34:26 +04:00
|
|
|
|
2014-06-18 15:11:47 +04:00
|
|
|
def empty_param? param
|
|
|
|
|
param.nil? or param.empty?
|
2014-05-08 15:34:26 +04:00
|
|
|
end
|
2014-06-18 15:11:47 +04:00
|
|
|
|
2014-05-08 15:34:26 +04:00
|
|
|
end
|
|
|
|
|
end
|