Class: VagrantPlugins::ProviderKvm::Action::PrepareNFSSettings
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderKvm::Action::PrepareNFSSettings
- Defined in:
- lib/vagrant-kvm/action/prepare_nfs_settings.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ PrepareNFSSettings
constructor
A new instance of PrepareNFSSettings.
-
#read_host_ip ⇒ String
Returns the IP address of the host.
-
#read_machine_ip ⇒ String
Returns the IP address of the guest by looking at the first enabled host only network.
- #using_nfs? ⇒ Boolean
Constructor Details
#initialize(app, env) ⇒ PrepareNFSSettings
Returns a new instance of PrepareNFSSettings.
5 6 7 8 |
# File 'lib/vagrant-kvm/action/prepare_nfs_settings.rb', line 5 def initialize(app,env) @app = app @logger = Log4r::Logger.new("vagrant::action::vm::nfs") end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-kvm/action/prepare_nfs_settings.rb', line 10 def call(env) @app.call(env) @machine = env[:machine] if using_nfs? env[:nfs_host_ip] = read_host_ip env[:nfs_machine_ip] = read_machine_ip end end |
#read_host_ip ⇒ String
Returns the IP address of the host
28 29 30 31 32 33 |
# File 'lib/vagrant-kvm/action/prepare_nfs_settings.rb', line 28 def read_host_ip ip = read_machine_ip base_ip = ip.split(".") base_ip[3] = "1" base_ip.join(".") end |
#read_machine_ip ⇒ String
Returns the IP address of the guest by looking at the first enabled host only network.
39 40 41 |
# File 'lib/vagrant-kvm/action/prepare_nfs_settings.rb', line 39 def read_machine_ip @machine.provider.driver.read_machine_ip end |
#using_nfs? ⇒ Boolean
20 21 22 |
# File 'lib/vagrant-kvm/action/prepare_nfs_settings.rb', line 20 def using_nfs? @machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs } end |