class Vagrant::Plugin::Remote::Provisioner

Attributes

client[RW]

Add an attribute accesor for the client

Public Class Methods

new(machine, config, **opts) click to toggle source

Provisioner plugins receive machine and config on init that they expect to set as instance variables and use later. When we’re in server mode, this instance is only a client, and the local plugin is going to be reinstantiated over on the server side. We will still needs these two pieces of state on the server side, so in order to get them over there, we tack them onto the front as args for each client method call. The server will then peel off those two args and use them to initialize the plugin in local mode before it dispatches the method call.

@see Vagrant::Plugin::V2::Provisioner#initialize the local init

method we're overriding

@see Vagrant::CommandServe::Service::ProvisionerService where we

pop off the two args and reinitialize a local plugin
Calls superclass method
# File lib/vagrant/plugin/remote/provisioner.rb, line 22
def initialize(machine, config, **opts)
  @_machine = machine
  @_config = config
  if opts[:client].nil?
    raise ArgumentError,
      "Remote client is required for `#{self.class.name}`"
  end
  @client = opts[:client]
  super(machine, config)
end

Public Instance Methods

cleanup() click to toggle source
# File lib/vagrant/plugin/remote/provisioner.rb, line 33
def cleanup
  client.provision(@_machine, @_config)
end
configure(root_config) click to toggle source
# File lib/vagrant/plugin/remote/provisioner.rb, line 37
def configure(root_config)
  client.configure(@_machine, @_config, root_config)
end
provision() click to toggle source
# File lib/vagrant/plugin/remote/provisioner.rb, line 41
def provision
  client.provision(@_machine, @_config)
end