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.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 19 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.
6 7 8 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 6 def client @client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
9 10 11 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 9 def client @client end |
Class Method Details
.installed? ⇒ Boolean
15 16 17 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 15 def self.installed? client.installed? end |
.usable?(raise_error = false) ⇒ Boolean
11 12 13 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 11 def self.usable?(raise_error=false) client.usable? end |
Instance Method Details
#action(name) ⇒ Object
30 31 32 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 30 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.
39 40 41 42 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 39 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.
48 49 50 51 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 48 def capability?(cap_name) @logger.debug("checking for remote provider capability #{cap_name}") client.has_capability?(cap_name) end |
#initialize_capabilities!(*args, **opts) ⇒ Object
65 66 67 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 65 def initialize_capabilities!(*args, **opts) # no-op end |
#machine_id_changed ⇒ Object
53 54 55 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 53 def machine_id_changed client.machine_id_changed(@machine.to_proto) end |
#ssh_info ⇒ Object
57 58 59 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 57 def ssh_info client.ssh_info(@machine.to_proto) end |
#state ⇒ Object
61 62 63 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 61 def state client.state(@machine.to_proto) end |
#to_proto ⇒ Object
69 70 71 |
# File 'lib/vagrant/plugin/remote/provider.rb', line 69 def to_proto client.proto end |