summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-03-07 09:29:08 -0800
committerGitHub <noreply@github.com>2019-03-07 09:29:08 -0800
commit46f3bcb79f9dd56a038850f0587d15e1f7a742ba (patch)
tree5fe05bc7077d802c82c3efc91ede73bcfe8ba829
parentace9fb17ef7aa2d5d7a14c1eb6bdcd3702c9a55a (diff)
parent8103e0a2d8a612226976fe8fda64c769a0ed5283 (diff)
downloadchef-46f3bcb79f9dd56a038850f0587d15e1f7a742ba.tar.gz
Merge pull request #8281 from chef/aix_mount_13
mount: Add proper new lines when on AIX to prevent failures
-rw-r--r--lib/chef/provider/mount/aix.rb2
-rw-r--r--spec/unit/provider/mount/aix_spec.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 4c2ddbe791..a63649f470 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -164,7 +164,7 @@ class Chef
disable_fs
end
::File.open("/etc/filesystems", "a") do |fstab|
- fstab.puts("#{@new_resource.mount_point}:")
+ fstab.puts("\n\n#{@new_resource.mount_point}:")
if network_device?
device_details = device_fstab.split(":")
fstab.puts("\tdev\t\t= #{device_details[1]}")
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index 615f3c3304..5b7c48e3d7 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -202,12 +202,20 @@ WRONG
it "should enable mount if it is mounted and not enabled" do
@new_resource.options("nodev,rw")
stub_mounted_enabled(@provider, @mounted_output, "")
+ # Add existing mount to test enable action appends additional mount with seperating blank line
filesystems = StringIO.new
+ filesystems.puts <<~ETCFILESYSTEMS
+ /tmp/abc:
+ dev = /dev/sdz2
+ vfs = jfs2
+ mount = true
+ options = rw
+ ETCFILESYSTEMS
allow(::File).to receive(:open).with("/etc/filesystems", "a").and_yield(filesystems)
@provider.run_action(:enable)
- expect(filesystems.string).to match(%r{^/tmp/foo:\n\tdev\t\t= /dev/sdz1\n\tvfs\t\t= jfs2\n\tmount\t\t= false\n\toptions\t\t= nodev,rw\n$})
+ expect(filesystems.string).to match(%r{^\n\n/tmp/foo:\n\tdev\t\t= /dev/sdz1\n\tvfs\t\t= jfs2\n\tmount\t\t= false\n\toptions\t\t= nodev,rw\n$})
end
it "should not enable mount if it is mounted and already enabled and mount options are unchanged" do