Class: Vagrant::Plugin::Remote::Provisioner
- Inherits:
-
V2::Provisioner
- Object
- V2::Provisioner
- Vagrant::Plugin::Remote::Provisioner
- Defined in:
- lib/vagrant/plugin/remote/provisioner.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Add an attribute accesor for the client.
Attributes inherited from V2::Provisioner
Instance Method Summary collapse
- #cleanup ⇒ Object
- #configure(root_config) ⇒ Object
-
#initialize(machine, config, **opts) ⇒ Provisioner
constructor
Provisioner plugins receive machine and config on init that they expect to set as instance variables and use later.
- #provision ⇒ Object
Constructor Details
#initialize(machine, config, **opts) ⇒ Provisioner
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.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant/plugin/remote/provisioner.rb', line 25 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 |
Instance Attribute Details
#client ⇒ Object
Add an attribute accesor for the client
9 10 11 |
# File 'lib/vagrant/plugin/remote/provisioner.rb', line 9 def client @client end |
Instance Method Details
#cleanup ⇒ Object
36 37 38 |
# File 'lib/vagrant/plugin/remote/provisioner.rb', line 36 def cleanup client.provision(@_machine, @_config) end |
#configure(root_config) ⇒ Object
40 41 42 |
# File 'lib/vagrant/plugin/remote/provisioner.rb', line 40 def configure(root_config) client.configure(@_machine, @_config, root_config) end |
#provision ⇒ Object
44 45 46 |
# File 'lib/vagrant/plugin/remote/provisioner.rb', line 44 def provision client.provision(@_machine, @_config) end |