summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2018-06-11 22:12:10 -0400
committerGitHub <noreply@github.com>2018-06-11 22:12:10 -0400
commitdfe4ec2b3ae4e80e46789fa538ba6330b8497db4 (patch)
treecd0e7c976d223e32adacf2e484c039492aa15faf
parent799e6e2e7c6534d2ec063080ee42268b75bc9f5f (diff)
parenta3a4771a48add5712c66fe05bfc98f811a40a6fb (diff)
downloadchef-dfe4ec2b3ae4e80e46789fa538ba6330b8497db4.tar.gz
Merge pull request #7284 from MsysTechnologiesllc/dh/fix_mount_point_error_windows
Mount: Fix errors on Windows when using the mount_point property
-rw-r--r--lib/chef/provider/mount/windows.rb4
-rw-r--r--spec/unit/resource/mount_spec.rb10
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb
index 1bd932729d..590b2bfa52 100644
--- a/lib/chef/provider/mount/windows.rb
+++ b/lib/chef/provider/mount/windows.rb
@@ -40,9 +40,9 @@ class Chef
def load_current_resource
if is_volume(@new_resource.device)
- @mount = Chef::Util::Windows::Volume.new(@new_resource.name)
+ @mount = Chef::Util::Windows::Volume.new(@new_resource.mount_point)
else #assume network drive
- @mount = Chef::Util::Windows::NetUse.new(@new_resource.name)
+ @mount = Chef::Util::Windows::NetUse.new(@new_resource.mount_point)
end
@current_resource = Chef::Resource::Mount.new(@new_resource.name)
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index fd81901f45..721f30cf09 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -44,6 +44,16 @@ describe Chef::Resource::Mount do
expect(resource.device).to eql("/dev/sdb3")
end
+ it "allows you to set mount_point property" do
+ resource.mount_point "U:"
+ expect(resource.mount_point).to eql("U:")
+ end
+
+ it "raises error when mount_point property is not set" do
+ resource.mount_point nil
+ expect { resource.mounted("poop") }.to raise_error(ArgumentError)
+ end
+
it "sets fsck_device to '-' by default" do
expect(resource.fsck_device).to eql("-")
end