summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/windows_pagefile.rb5
-rw-r--r--spec/functional/resource/windows_pagefile_spec.rb4
-rw-r--r--spec/unit/resource/windows_pagefile_spec.rb4
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb
index 3b2e05710f..0227b50255 100644
--- a/lib/chef/resource/windows_pagefile.rb
+++ b/lib/chef/resource/windows_pagefile.rb
@@ -66,7 +66,7 @@ class Chef
DOC
property :path, String,
- coerce: proc { |x| x.tr("/", "\\") },
+ coerce: proc { |x| x[0] },
description: "An optional property to set the pagefile name if it differs from the resource block's name.",
name_property: true
@@ -112,7 +112,8 @@ class Chef
end
action :delete, description: "Deletes the specified pagefile." do
- delete(new_resource.path) if exists?(new_resource.path)
+ pagefile = (new_resource.path[0] + ":\\pagefile.sys")
+ delete(pagefile ) if exists?(pagefile )
end
action_class do
diff --git a/spec/functional/resource/windows_pagefile_spec.rb b/spec/functional/resource/windows_pagefile_spec.rb
index d7df445b93..ba50b34b2a 100644
--- a/spec/functional/resource/windows_pagefile_spec.rb
+++ b/spec/functional/resource/windows_pagefile_spec.rb
@@ -21,8 +21,8 @@ require "chef/mixin/powershell_exec"
describe Chef::Resource::WindowsPagefile, :windows_only do
include Chef::Mixin::PowershellExec
- let(:c_path) { 'c:\pagefile.sys' }
- let(:e_path) { 'e:\pagefile.sys' }
+ let(:c_path) { 'C' }
+ let(:e_path) { 'E' }
let(:run_context) do
node = Chef::Node.new
diff --git a/spec/unit/resource/windows_pagefile_spec.rb b/spec/unit/resource/windows_pagefile_spec.rb
index c1bf77948a..e8e81cd63e 100644
--- a/spec/unit/resource/windows_pagefile_spec.rb
+++ b/spec/unit/resource/windows_pagefile_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Resource::WindowsPagefile do
end
it "the path property is the name_property" do
- expect(resource.path).to eql("C:\\pagefile.sys")
+ expect(resource.path).to eql("C")
end
it "sets the default action as :set" do
@@ -39,6 +39,6 @@ describe Chef::Resource::WindowsPagefile do
it "coerces forward slashes in the path property to back slashes" do
resource.path "C:/pagefile.sys"
- expect(resource.path).to eql("C:\\pagefile.sys")
+ expect(resource.path).to eql("C")
end
end