From 4fd23737536d0981cbba85153a02a7f86faaabc4 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Sun, 17 Nov 2019 00:27:06 -0300 Subject: [PATCH] nfs: avoid adding extra newlines to /etc/exports StringBlockEditor already adds the necessary newlines. That extra newline was making /etc/exports longer and longer, full of empty lines, because StringBlockEditor doesn't know about it and does not remove it. --- plugins/hosts/linux/cap/nfs.rb | 2 +- test/unit/plugins/hosts/linux/cap/nfs_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/hosts/linux/cap/nfs.rb b/plugins/hosts/linux/cap/nfs.rb index addc7ee89..ab31de9e6 100644 --- a/plugins/hosts/linux/cap/nfs.rb +++ b/plugins/hosts/linux/cap/nfs.rb @@ -77,7 +77,7 @@ module VagrantPlugins sleep 0.5 nfs_cleanup("#{Process.uid} #{id}") - output = "#{nfs_exports_content}\n#{output}" + output = nfs_exports_content + output nfs_write_exports(output) if nfs_running?(nfs_check_command) diff --git a/test/unit/plugins/hosts/linux/cap/nfs_test.rb b/test/unit/plugins/hosts/linux/cap/nfs_test.rb index 860c9b172..717783930 100644 --- a/test/unit/plugins/hosts/linux/cap/nfs_test.rb +++ b/test/unit/plugins/hosts/linux/cap/nfs_test.rb @@ -188,7 +188,7 @@ EOH :linux__nfs_options=>["rw","all_squash"]}} valid_id = SecureRandom.uuid content =<<-EOH -\n# VAGRANT-BEGIN: #{Process.uid} #{valid_id} +# VAGRANT-BEGIN: #{Process.uid} #{valid_id} "/home/vagrant" 127.0.0.1(rw,all_squash,anonuid=,anongid=,fsid=) "/newhome/otherproject" 127.0.0.1(rw,all_squash,anonuid=,anongid=,fsid=) # VAGRANT-END: #{Process.uid} #{valid_id}