Commit Graph

121 Commits

Author SHA1 Message Date
Kevin Carmody 17c171559f Update nfs.rb
Make call to exportfs just use the system path.
2014-03-22 21:07:45 +00:00
Russell Jackson a3c94ab910 Fix Linux NFS exports pruning due to bad `sed` expression
The mount id is a file path which will contain forward slashes. A
previous attempt (although notably missing in the Linux host plugin) at
fixing this used `String.gsub` to escape the forward slashes; however,
the solution that eventually made its way into the 1.5 release uses
`Regexp.escape` which doesn't escape forward slashes.

The Ruby `Regexp.escape` method does not escape forward slashes because
they are not RE meta-characters; their special meaning is specific to
sed expressions as delimiters. To avoid the issue entirely, we can use
an alternative delimiter by prefixing the address expression with a
backslash with the desired delimiter character following.

Use control character (ASCII code point `0x01`) as expression delimiter
so it is very unlikely an identifier will have a conflicting character
within it.
2014-03-12 12:25:53 -07:00
Mitchell Hashimoto d14f3e0a56 hosts/bsd: make directories unique when exporting 2014-02-26 08:04:21 -08:00
Mitchell Hashimoto 7abcea35b8 hosts/linux: escape regular expression for prune NFS exports [GH-2934] 2014-02-24 07:51:06 -08:00
Jon Topper 7b30e557cd hosts/bsd: sort NFS exports to avoid false validation errors [GH-2927]
With a synced folder configuration like so:

 synced_folder ".", "/vagrant", :nfs => true
 synced_folder "#{ENV['HOME']}/mirror", "/mirror", :nfs => true
 synced_folder ENV['HOME'], "/home/#{ENV['USER']}", :nfs => true

on OSX, vagrant writes two overlapping exports to /etc/exports
which then fail the export check.

Iterating through the list of folders lexically builds a correct, single
exports entry.

Signed-off-by: Teemu Matilainen <teemu.matilainen@iki.fi>
2014-02-21 23:43:11 -03:00
Mitchell Hashimoto b89a47c955 hosts/opensuse: start NFS server properly [GH-2923] 2014-02-03 12:18:09 +01:00
Mitchell Hashimoto 7e9ea7c1c6 hosts/redhat: recognize Korora [GH-2869] 2014-01-21 09:50:20 -08:00
Mitchell Hashimoto fbd8cfc628 hosts/gentoo: more robust check for systemctl path on Gentoo 2014-01-18 11:03:46 -08:00
Tim Gus f0ec355a33 hosts/gentoo: fix nonstandard path to systemctl command 2014-01-18 00:13:54 -05:00
BlackEagle b30eacf94f nfs_apply :: exportfs sometimes leaves exports behind
On my machine i had a case where /etc/exports was updated but the old
exports were still there. This was leading to
"exportfs: duplicated export entries" and eventually leading to nfs
being not available for the box.

changing the command exportfs -r to exportfs -ar seems to address this
issue.

Signed-off-by: BlackEagle <ike.devolder@gmail.com>
2014-01-17 10:54:17 +01:00
Gustavo Gama 262e2c0192 Fix typo 2014-01-15 09:40:41 -02:00
Mitchell Hashimoto 9b383740ba hosts/bsd: use Util::Which instead of system("which") 2014-01-12 22:37:39 -08:00
Mitchell Hashimoto b8601423c7 hosts/bsd: don't execute shell for sudo commands [GH-2808] 2014-01-12 22:34:45 -08:00
Mitchell Hashimoto e9f6c81ab7 hosts/*: proper detect API 2014-01-07 21:18:36 -08:00
Mitchell Hashimoto 26b564566b hosts/null: needs to accept env as param 2014-01-07 21:14:33 -08:00
Mitchell Hashimoto a72e7473d5 hosts/windows: convert 2014-01-07 21:13:21 -08:00
Mitchell Hashimoto 4d47dae5b9 many more hosts converted 2014-01-07 21:11:59 -08:00
Mitchell Hashimoto 4cec8b48d9 hosts/freebsd: convert 2014-01-07 21:01:03 -08:00
Mitchell Hashimoto a6c7cc481e convert more hosts: arch and linux 2014-01-07 20:53:39 -08:00
Mitchell Hashimoto bdb88da743 hosts/bsd: convert to new style 2014-01-07 20:39:24 -08:00
Mitchell Hashimoto 5e490e3746 Get tests to pass 2014-01-07 19:26:03 -08:00
Mitchell Hashimoto 2cf864e95b hosts/bsd: check exports only if exports file exists [GH-2714] 2013-12-28 13:48:13 -07:00
Mitchell Hashimoto 2bebf188d6 hosts/bsd: check for exports file issues prior to exporting NFS 2013-12-13 22:14:13 -08:00
Mitchell Hashimoto 05e9dc6e59 Update CHANGELOG 2013-11-23 11:36:20 -08:00
Mitchell Hashimoto 52c27cd498 Merge pull request #2448 from rimckenn/patch-1
hosts/bsd: don't set both maproot and mapall
2013-11-23 11:34:27 -08:00
Rudolf Leermakers aa749db079 Restart NFS on Gentoo host instead of starting
In the case that NFS is already started on a Gentoo host, /etc/init.d/nfs start will not reload exports, but fail. /etc/init.d/nfs reload is known to fail for some esoteric configurations of /etc/exports, restart should be safe for existing connections.
2013-11-11 12:30:40 +01:00
rimckenn 3047b81256 Update host.rb
mapall= and maproot= are mutually exclusive options. Currently, when trying to use maproot=, mapall= is getting automatically added, which prevents us from using the NFS mount. This change turns off the adding of mapall= if maproot= has been specified as an option.
2013-11-01 14:44:49 +00:00
Mitchell Hashimoto 673a06b54d hosts/gentoo: use subprocess machinery
/cc @timgus
2013-10-17 08:32:09 -10:00
Tim Gus 7bfc3ea16e hosts/gentoo: recognize systemd for nfsd startup and
replace "service" command with /etc/init.d/nfs
2013-10-17 11:11:59 -04:00
Matthew e9903422cc detect Red Hat Enterprise Linux 4 and Oracle Linux 2013-10-05 18:01:27 +01:00
Matthew b16d56c717 rename host plugin (fedora to redhat) 2013-10-05 17:40:23 +01:00
Matthew d1871b5c15 do not use systemd on current versions of CentOS or RHEL 2013-10-05 17:33:13 +01:00
viq 8fd2337038 Fix invocation of initialize
Fixes #2229 for me
2013-09-19 11:55:46 +02:00
keyist 8cc5b4ddb5 hosts/arch: remove duplication with HostsLinux 2013-09-16 21:27:15 -07:00
Raman Nanda 1566280061 Cleanup for Pull Request 2013-09-11 17:57:54 -04:00
Raman Nanda 0c03ad18fc Updating for NFS Fix 2013-09-11 17:22:13 -04:00
David d3ab29e279 Put nfs opts setup in separate function and configured to be called by both generic linux and arch nfs_options. Fixes undefined method join exception in arch 2013-09-10 11:39:41 -04:00
Mitchell Hashimoto 8a9ee5d8dc hosts/arch: correct variable for NFS exports [GH-2161] 2013-09-07 17:49:52 -07:00
Mitchell Hashimoto c29925a6a5 Merge pull request #2156 from gustavobgama/fix/master/linux_nfs_error
hosts/linux: fixed options to NFS: no_subtree and check became no_subtree_check
2013-09-07 17:44:25 -07:00
Eric G. Wolfe 1186c86718 [GH-1977] revert and alternate fix
@mitchellh, the internal encoding doesn't seem to work.  Therefore,
I reverted that previous change to vagrant.rb.

However, I found two alternate solutions.  Either transcoding,
`/etc/redhat-release` to ISO-8859-1 on open, or using something
like File.binread to transcode the file contents to raw.
2013-09-07 13:40:23 -04:00
Gustavo Gama 693b813d63 Fixed options to NFS: no_subtree and check became no_subtree_check 2013-09-07 12:09:09 -03:00
Mitchell Hashimoto bad4c78766 hosts/linux: fix undefined variable in NFS export [GH-2137] 2013-09-06 08:54:02 -07:00
Mitchell Hashimoto e8d2e05c4e Merge pull request #2077 from miurahr/exportfs
Improvement of Linux supports and NFS handling using exportfs
2013-09-02 14:52:59 -07:00
Mitchell Hashimoto 3a14d27f90 core: Arbitrary NFS options with nfs_options [GH-1029] 2013-09-01 13:08:02 -07:00
Mitchell Hashimoto 2d2180e5a5 hosts/linux: fix NFS prune regex 2013-09-01 12:00:36 -07:00
Mitchell Hashimoto a6aa16dcad hosts/bsd: proper NFS prune sed syntax 2013-09-01 11:58:52 -07:00
Mitchell Hashimoto 65ef8d2477 Merge branch 'nfs-per-user' of https://github.com/davedevelopment/vagrant into davedevelopment-nfs-per-user
Conflicts:
	plugins/hosts/arch/host.rb
	plugins/hosts/bsd/host.rb
	plugins/hosts/linux/host.rb
	templates/nfs/exports.erb
	templates/nfs/exports_freebsd.erb
	templates/nfs/exports_linux.erb
2013-09-01 11:44:00 -07:00
Mitchell Hashimoto c63d4fd6b8 hosts/bsd: nice error if can't read exports file [GH-2038] 2013-09-01 10:25:00 -07:00
Michael G. Noll 5058f351b1 GH-2087: Detect RHEL (Red Hat Enterprise Linux Server) properly 2013-08-28 09:19:08 +02:00
Michael G. Noll 95f5f553d9 GH-2088: Use proper regex capture group to detect OS version of RHEL family 2013-08-28 09:17:23 +02:00
Elan Ruusamäe fda6bf7bf7 fix broken regexp from 2a9d0c9 2013-08-27 22:16:37 +03:00
KATOH Yasufumi 05d27d20e4 improve slackware/plamo detection and change nfs_check_command
* On Slackware, /etc/rc.d/rc.nfsd has no "status" argument, so the check command change to pidof command.
* On Plamo Linux, there is no /etc/slackware-release file, so use "/usr/lib/setup/Plamo-*" instead.
2013-08-27 08:13:23 +09:00
Hiroshi Miura 3d886671a6 fix typo for slackware
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2013-08-25 00:10:18 +09:00
Hiroshi Miura bae7dbb0e2 Support slackware linux
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2013-08-24 22:11:22 +09:00
Hiroshi Miura f2b83ac662 export nfs gracer way in Linux
To reload /etc/exports, /sbin/exportfs is best way
to command it in standard.
It modify generic linux to check daemon status
before restart instead of restarting everytime.

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2013-08-24 22:11:22 +09:00
gwenci 2a9d0c9d7f Update host.rb
Vagrant has been failing to run on CentOS 6 since version 1.2.5.
The read of file /etc/redhat-release appeared to be only checking for the word Fedora. Altered the regex to match CentOS as well
2013-07-30 18:00:08 +01:00
Mitchell Hashimoto e73e2b375d Register fedora host as CentOS too [GH-1394] 2013-07-18 11:23:46 -04:00
Mitchell Hashimoto 3028940adb NFS allows access from all networks on VM [GH-1204] 2013-07-18 00:01:49 -04:00
Mitchell Hashimoto 608bc7c0eb NFS exports with single quotes now work properly [GH-1166] 2013-07-16 16:23:33 -07:00
Mitchell Hashimoto 2657364921 Exported sub-directories of exported NFS dirs works on BSD [GH-785] 2013-07-10 14:19:57 -07:00
Brett Stauner 442300794e Support Fedora when it was "Fedora Core"
The version_number regex was causing an error because my /etc/redhat-release looks like this:

Fedora Core release 6 (Zod)

This fix allowed initialize to run just fine on my ridiculously old release.
2013-07-09 15:47:49 -05:00
Dave Marshall b8a8286fac Use current user's uid for NFS exports 2013-03-29 00:14:12 +00:00
Mitchell Hashimoto a53d569656 When cleaning NFS, properly escape certain characters 2013-02-08 16:18:57 -08:00
Mitchell Hashimoto 5a33b7ee54 Hosts to V2 2012-11-06 21:20:22 -08:00
patrick brisbin 8c7c345bc0 Use a better check for systemd
Using `which systemctl` would return true on even non-systemd machines
during this transitional time.
2012-10-26 14:16:04 -04:00
patrick brisbin 6905513481 Fix match? and nfs? for Arch host 2012-10-26 14:15:58 -04:00
Mitchell Hashimoto 184f6dccb2 Forward port GH-1142 2012-09-18 22:26:51 -07:00
Mitchell Hashimoto f7c231758f Forward Port GH-1140 2012-09-18 22:19:51 -07:00
Mitchell Hashimoto 70bdd9f56e Move host base class to a plugin component 2012-06-27 09:26:03 -07:00
Mitchell Hashimoto 096e61b122 Get rid of autoload in hosts plugins 2012-05-23 16:03:14 -07:00
Mitchell Hashimoto 9956e6d012 Better directory structure for plugins 2012-04-20 16:53:01 -07:00