Class: Vagrant::Plugin::Remote::Provider
- Inherits:
-
V2::Provider
- Object
- V2::Provider
- Vagrant::Plugin::Remote::Provider
- Defined in:
- lib/vagrant/plugin/remote/provider.rb
Class Attribute Summary collapse
-
.client ⇒ Object
readonly
Returns the value of attribute client.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #action(name) ⇒ Object
-
#capability(cap_name, *args) ⇒ Object
Executes the capability with the given name, optionally passing more arguments onwards to the capability.
-
#capability?(cap_name) ⇒ Boolean
Tests whether the given capability is possible.
-
#initialize(machine, **opts) ⇒ Provider
constructor
A new instance of Provider.
- #initialize_capabilities!(*args, **opts) ⇒ Object
- #machine_id_changed ⇒ Object
- #ssh_info ⇒ Object
- #state ⇒ Object
- #to_proto ⇒ Object
Methods inherited from V2::Provider
Methods included from CapabilityHost
Constructor Details
#initialize(machine, **opts) ⇒ Provider
Returns a new instance of Provider.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 22 def initialize(machine, **opts) @logger = Log4r::Logger.new("vagrant::remote::provider") @logger.debug("initializing provider with remote backend") @machine = machine if opts[:client].nil? raise ArgumentError, "Remote client is required for `#{self.class.name}`" end @client = opts.delete(:client) end |
Class Attribute Details
.client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 9 def client @client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
12 13 14 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 12 def client @client end |
Class Method Details
.installed? ⇒ Boolean
18 19 20 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 18 def self.installed? client.installed? end |
.usable?(raise_error = false) ⇒ Boolean
14 15 16 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 14 def self.usable?(raise_error=false) client.usable? end |
Instance Method Details
#action(name) ⇒ Object
33 34 35 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 33 def action(name) client.action(@machine.to_proto, name) end |
#capability(cap_name, *args) ⇒ Object
Executes the capability with the given name, optionally passing more arguments onwards to the capability. If the capability returns a value, it will be returned.
42 43 44 45 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 42 def capability(cap_name, *args) @logger.debug("running remote provider capability #{cap_name} with args #{args}") client.capability(cap_name, @machine, *args) end |
#capability?(cap_name) ⇒ Boolean
Tests whether the given capability is possible.
51 52 53 54 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 51 def capability?(cap_name) @logger.debug("checking for remote provider capability #{cap_name}") client.has_capability?(cap_name) end |
#initialize_capabilities!(*args, **opts) ⇒ Object
68 69 70 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 68 def initialize_capabilities!(*args, **opts) # no-op end |
#machine_id_changed ⇒ Object
56 57 58 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 56 def machine_id_changed client.machine_id_changed(@machine.to_proto) end |
#ssh_info ⇒ Object
60 61 62 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 60 def ssh_info client.ssh_info(@machine.to_proto) end |
#state ⇒ Object
64 65 66 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 64 def state client.state(@machine.to_proto) end |
#to_proto ⇒ Object
72 73 74 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 72 def to_proto client.proto end |