Class: Vagrant::Communication::Base
- Inherits:
-
Object
- Object
- Vagrant::Communication::Base
- Defined in:
- lib/vagrant/communication/base.rb
Overview
The base class for any classes that provide an API for communicating with the virtual machine.
There are various stages that require Vagrant to copy files or run commands on the target system, and communication classes provide the abstraction necessary to perform these tasks, via SSH or some other mechanism.
Any subclasses of this class must implement all of the methods below.
Direct Known Subclasses
Instance Method Summary collapse
-
#execute(command, opts = nil) {|type, data| ... } ⇒ Integer
Execute a command on the remote machine.
-
#ready? ⇒ Boolean
Checks if the target machine is ready for communication.
-
#sudo(command, opts = nil) ⇒ Object
Execute a comand with super user privileges.
-
#test(command, opts = nil) ⇒ Object
Executes a command and returns a boolean statement if it was successful or not.
-
#upload(from, to) ⇒ Object
Upload a file to the virtual machine.
Instance Method Details
#execute(command, opts = nil) {|type, data| ... } ⇒ Integer
Execute a command on the remote machine.
34 35 |
# File 'lib/vagrant/communication/base.rb', line 34 def execute(command, opts=nil) end |
#ready? ⇒ Boolean
Checks if the target machine is ready for communication.
17 18 |
# File 'lib/vagrant/communication/base.rb', line 17 def ready? end |
#sudo(command, opts = nil) ⇒ Object
Execute a comand with super user privileges.
See #execute for parameter information.
40 41 |
# File 'lib/vagrant/communication/base.rb', line 40 def sudo(command, opts=nil) end |
#test(command, opts = nil) ⇒ Object
Executes a command and returns a boolean statement if it was successful or not.
This is implemented by default as expecting execute
to return 0.
47 48 49 50 51 52 53 |
# File 'lib/vagrant/communication/base.rb', line 47 def test(command, opts=nil) # Disable error checking no matter what opts = (opts || {}).merge(:error_check => false) # Successful if the exit status is 0 execute(command, opts) == 0 end |
#upload(from, to) ⇒ Object
Upload a file to the virtual machine.
24 25 |
# File 'lib/vagrant/communication/base.rb', line 24 def upload(from, to) end |