Class: Vagrant::Cloners::Cloner
- Inherits:
-
Object
- Object
- Vagrant::Cloners::Cloner
- Includes:
- Singleton
- Defined in:
- lib/vagrant-cloner/cloner.rb
Overview
Cloner defines the base API that a cloner has to modify a VM or remote systems. TODO: Create a method that downloads to local and then uploads to VM?
Direct Known Subclasses
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#env ⇒ Object
Returns the value of attribute env.
-
#options ⇒ Object
Returns the value of attribute options.
-
#run_order ⇒ Object
Returns the value of attribute run_order.
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #name ⇒ Object
-
#scp(*args, &block) ⇒ Object
Opens an SCP connection to an arbitrary server, downloading or uploading to the machine currently in scope (whether the host machine or the VM).
-
#ssh(*args, &block) ⇒ Object
Opens an SSH connection to an arbitrary server and passes it to a supplied block.
- #validate!(env, errors) ⇒ Object
-
#vm ⇒ Object
Shorthand for addressing the SSH communicator to the VM.
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
14 15 16 |
# File 'lib/vagrant-cloner/cloner.rb', line 14 def enabled @enabled end |
#env ⇒ Object
Returns the value of attribute env.
14 15 16 |
# File 'lib/vagrant-cloner/cloner.rb', line 14 def env @env end |
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/vagrant-cloner/cloner.rb', line 14 def @options end |
#run_order ⇒ Object
Returns the value of attribute run_order.
14 15 16 |
# File 'lib/vagrant-cloner/cloner.rb', line 14 def run_order @run_order end |
Instance Method Details
#enabled? ⇒ Boolean
24 25 26 |
# File 'lib/vagrant-cloner/cloner.rb', line 24 def enabled? @enabled.nil? ? false : @enabled end |
#name ⇒ Object
16 17 18 |
# File 'lib/vagrant-cloner/cloner.rb', line 16 def name raise "Cloner must define #name and return a string." end |
#scp(*args, &block) ⇒ Object
Opens an SCP connection to an arbitrary server, downloading or uploading to the machine currently in scope (whether the host machine or the VM). Recommended params:
remote_host, remote_user, {:password => remote_password}
See netscp documentation for further method options. github.com/net-ssh/net-scp
54 55 56 |
# File 'lib/vagrant-cloner/cloner.rb', line 54 def scp(*args, &block) Net::SCP.start(*args, &block) end |
#ssh(*args, &block) ⇒ Object
Opens an SSH connection to an arbitrary server and passes it to a supplied block.
See netssh documentation for further method options. net-ssh.github.com/net-ssh/
43 44 45 |
# File 'lib/vagrant-cloner/cloner.rb', line 43 def ssh(*args, &block) Net::SSH.start(*args, &block) end |
#validate!(env, errors) ⇒ Object
20 21 22 |
# File 'lib/vagrant-cloner/cloner.rb', line 20 def validate!(env, errors) true end |
#vm ⇒ Object
Shorthand for addressing the SSH communicator to the VM. View available methods here: github.com/mitchellh/vagrant/blob/master/plugins/communicators/ssh/communicator.rb
35 36 37 |
# File 'lib/vagrant-cloner/cloner.rb', line 35 def vm env[:vm].channel end |