vagrant-nfs_guest 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e97ac578150a2727e68ad6b145a8e0e1930fb847
4
+ data.tar.gz: 20b94b0d05c5623f9795d49022a55767191d8860
5
+ SHA512:
6
+ metadata.gz: c8d1db44a16ee5695893ae80eb1e9ec88be1debfcb0104a3ce06bde144fa8894df6cabf52f82bd493f1781e0f404eb8e08160e0752e3d4174be792559ee022d7
7
+ data.tar.gz: 9926c33a284c8a7c6e9fcd44852db43cc214ea50f8de3bab8d2379cd7c5b9a0cedcfd14f143c5db2c892954c52f826af6d339d6bdad1dbf2581c3869071d993c
@@ -6,6 +6,8 @@ module VagrantPlugins
6
6
  attr_accessor :functional
7
7
  attr_accessor :map_uid
8
8
  attr_accessor :map_gid
9
+ attr_accessor :host_ip
10
+ attr_accessor :guest_ip
9
11
 
10
12
  def initialize
11
13
  super
@@ -13,12 +15,16 @@ module VagrantPlugins
13
15
  @functional = UNSET_VALUE
14
16
  @map_uid = UNSET_VALUE
15
17
  @map_gid = UNSET_VALUE
18
+ @host_ip = UNSET_VALUE
19
+ @guest_ip = UNSET_VALUE
16
20
  end
17
21
 
18
22
  def finalize!
19
23
  @functional = true if @functional == UNSET_VALUE
20
24
  @map_uid = nil if @map_uid == UNSET_VALUE
21
25
  @map_gid = nil if @map_gid == UNSET_VALUE
26
+ @host_ip = nil if @host_ip == UNSET_VALUE
27
+ @guest_ip = nil if @guest_ip == UNSET_VALUE
22
28
  end
23
29
 
24
30
  def to_s
@@ -106,8 +106,7 @@ module VagrantPlugins
106
106
  # by Vagrant
107
107
  #
108
108
  machine.communicate.sudo(
109
- "sed -r -e '/^# VAGRANT-BEGIN:( #{user})? #{id}/,/^# " +
110
- "VAGRANT-END:( #{user})? #{id}/ d' -ibak /etc/exports",
109
+ "sed -r -e '/^# VAGRANT(-NFS_GUEST)?-BEGIN/,/^# VAGRANT(-NFS_GUEST)?-END/ d' -ibak /etc/exports",
111
110
  error_class: Errors::GuestNFSError,
112
111
  error_key: :nfs_guest_clean
113
112
  )
@@ -1,25 +1,27 @@
1
1
  module VagrantPlugins
2
- module GuestLinux
3
- module Cap
4
- class ReadUserIDs
5
- def self.read_uid(machine)
6
- command = "id -u"
7
- result = ""
8
- machine.communicate.execute(command) do |type, data|
9
- result << data if type == :stdout
2
+ module SyncedFolderNFSGuest
3
+ module GuestLinux
4
+ module Cap
5
+ class ReadUserIDs
6
+ def self.read_uid(machine)
7
+ command = "id -u"
8
+ result = ""
9
+ machine.communicate.execute(command) do |type, data|
10
+ result << data if type == :stdout
11
+ end
12
+
13
+ result.chomp.split("\n").first
10
14
  end
11
15
 
12
- result.chomp.split("\n").first
13
- end
16
+ def self.read_gid(machine)
17
+ command = "id -g"
18
+ result = ""
19
+ machine.communicate.execute(command) do |type, data|
20
+ result << data if type == :stdout
21
+ end
14
22
 
15
- def self.read_gid(machine)
16
- command = "id -g"
17
- result = ""
18
- machine.communicate.execute(command) do |type, data|
19
- result << data if type == :stdout
23
+ result.chomp.split("\n").first
20
24
  end
21
-
22
- result.chomp.split("\n").first
23
25
  end
24
26
  end
25
27
  end
@@ -15,18 +15,8 @@ module VagrantPlugins
15
15
  end
16
16
 
17
17
  def enable(machine, folders, nfsopts)
18
- raise Vagrant::Errors::NFSNoHostIP if !nfsopts[:nfs_guest_host_ip]
19
- raise Vagrant::Errors::NFSNoGuestIP if !nfsopts[:nfs_guest_machine_ip]
20
-
21
- if machine.guest.capability?(:nfs_server_installed)
22
- installed = machine.guest.capability(:nfs_server_installed)
23
- if !installed
24
- can_install = machine.guest.capability?(:nfs_server_install)
25
- raise Errors::NFSServerNotInstalledInGuest if !can_install
26
- machine.ui.info I18n.t("vagrant_nfs_guest.guests.linux.nfs_server_installing")
27
- machine.guest.capability(:nfs_server_install)
28
- end
29
- end
18
+ verify_nfs_options(machine, nfsopts)
19
+ verify_nfs_installation(machine) if machine.guest.capability?(:nfs_server_installed)
30
20
 
31
21
  machine_ip = nfsopts[:nfs_guest_machine_ip]
32
22
  machine_ip = [machine_ip] if !machine_ip.is_a?(Array)
@@ -79,6 +69,39 @@ module VagrantPlugins
79
69
  # (value == :auto)
80
70
  return machine.guest.capability("read_#{perm}".to_sym)
81
71
  end
72
+
73
+ private
74
+
75
+ def verify_nfs_installation(machine)
76
+ if !machine.guest.capability(:nfs_server_installed)
77
+ raise Errors::NFSServerNotInstalledInGuest unless machine.guest.capability?(:nfs_server_install)
78
+
79
+ machine.ui.info I18n.t("vagrant_nfs_guest.guests.linux.nfs_server_installing")
80
+ machine.guest.capability(:nfs_server_install)
81
+ end
82
+ end
83
+
84
+ def verify_nfs_options(machine, nfsopts = {})
85
+ if !nfsopts[:nfs_guest_host_ip]
86
+ if machine.config.nfs_guest.host_ip
87
+ nfsopts[:nfs_guest_host_ip] = machine.config.nfs_guest.host_ip
88
+ end
89
+
90
+ raise Vagrant::Errors::NFSNoHostIP if !nfsopts[:nfs_guest_host_ip]
91
+ end
92
+
93
+ if !nfsopts[:nfs_guest_machine_ip]
94
+ if machine.config.nfs_guest.guest_ip
95
+ nfsopts[:nfs_guest_machine_ip] = machine.config.nfs_guest.guest_ip
96
+ end
97
+
98
+ raise Vagrant::Errors::NFSNoGuestIP if !nfsopts[:nfs_guest_machine_ip]
99
+ end
100
+ end
101
+
102
+ def extract_guest_ip(folder)
103
+ folder[:guest_ip] || folder[:machine_ip]
104
+ end
82
105
  end
83
106
  end
84
107
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module SyncedFolderNFSGuest
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -48,3 +48,6 @@ en:
48
48
 
49
49
  nfs_server_not_installed: |-
50
50
  Guest cannot install the required NFS server daemon.
51
+
52
+ nfs_guest_clean: |-
53
+ Something failed while cleaning up NFS shared folders on the guest.
@@ -1,7 +1,7 @@
1
- # VAGRANT-BEGIN: <%= user %> <%= uuid %>
1
+ # VAGRANT-NFS_GUEST-BEGIN
2
2
  <% ips.each do |ip| %>
3
3
  <% folders.each do |dirs, opts| %>
4
4
  "<%= opts[:guestpath] %>" <%= ip %>(<%= opts[:linux__nfs_options].join(",") %>)
5
5
  <% end %>
6
6
  <% end %>
7
- # VAGRANT-END: <%= user %> <%= uuid %>
7
+ # VAGRANT-NFS_GUEST-END
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-nfs_guest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.1.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alan Garfield
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: Adds support for guest nfs exporting of synced folders
@@ -50,7 +45,7 @@ executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .gitignore
48
+ - ".gitignore"
54
49
  - Gemfile
55
50
  - LICENSE.txt
56
51
  - README.md
@@ -80,32 +75,25 @@ files:
80
75
  homepage: ''
81
76
  licenses:
82
77
  - MIT
78
+ metadata: {}
83
79
  post_install_message:
84
80
  rdoc_options: []
85
81
  require_paths:
86
82
  - lib
87
83
  required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
84
  requirements:
90
- - - ! '>='
85
+ - - ">="
91
86
  - !ruby/object:Gem::Version
92
87
  version: '0'
93
- segments:
94
- - 0
95
- hash: 2496989375820171148
96
88
  required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
89
  requirements:
99
- - - ! '>='
90
+ - - ">="
100
91
  - !ruby/object:Gem::Version
101
92
  version: '0'
102
- segments:
103
- - 0
104
- hash: 2496989375820171148
105
93
  requirements: []
106
94
  rubyforge_project:
107
- rubygems_version: 1.8.23.2
95
+ rubygems_version: 2.2.2
108
96
  signing_key:
109
- specification_version: 3
97
+ specification_version: 4
110
98
  summary: Adds support for guest nfs exporting of synced folders
111
99
  test_files: []