mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-07-15 12:01:59 -04:00
Only clean up /etc/fstab if it really contains Vagrant data
This change, together with `allow_fstab_modification = false`, allows to run a guest without root/sudo privileges which been broken since Vagrant 2.2.10.
This commit is contained in:
parent
82fb402fef
commit
abe87b2fdc
1 changed files with 9 additions and 1 deletions
|
|
@ -64,9 +64,17 @@ module VagrantPlugins
|
|||
machine.communicate.test("test -f /etc/fstab")
|
||||
end
|
||||
|
||||
def self.contains_vagrant_data?(machine)
|
||||
machine.communicate.test("grep '#VAGRANT-BEGIN' /etc/fstab")
|
||||
end
|
||||
|
||||
def self.remove_vagrant_managed_fstab(machine)
|
||||
if fstab_exists?(machine)
|
||||
machine.communicate.sudo("sed -i '/\#VAGRANT-BEGIN/,/\#VAGRANT-END/d' /etc/fstab")
|
||||
if contains_vagrant_data?(machine)
|
||||
machine.communicate.sudo("sed -i '/\#VAGRANT-BEGIN/,/\#VAGRANT-END/d' /etc/fstab")
|
||||
else
|
||||
@@logger.info("no vagrant data in fstab file, carrying on")
|
||||
end
|
||||
else
|
||||
@@logger.info("no fstab file found, carrying on")
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue