summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Leff <adam@leff.co>2017-10-19 19:44:53 -0400
committerGitHub <noreply@github.com>2017-10-19 19:44:53 -0400
commitc73317a1cc761b2987e5d185d71354b29c52a9b0 (patch)
tree65d29e5f3fe46b53c9e4a49595054e4f3c13613e
parentc1e69f28fa181157aa6a61c2899c280baa532ef5 (diff)
parent90e6ac9a899f6aae856b661f7c8a835aa0ba5c22 (diff)
downloadchef-c73317a1cc761b2987e5d185d71354b29c52a9b0.tar.gz
Merge pull request #6510 from chef/nodes_not_here
Fix remote_file with UNC paths failing
-rw-r--r--lib/chef/mixin/user_context.rb2
-rw-r--r--spec/unit/mixin/user_context_spec.rb3
-rw-r--r--spec/unit/provider/remote_file/network_file_spec.rb2
3 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/mixin/user_context.rb b/lib/chef/mixin/user_context.rb
index 40a72912a3..526d6b0f3f 100644
--- a/lib/chef/mixin/user_context.rb
+++ b/lib/chef/mixin/user_context.rb
@@ -23,7 +23,7 @@ class Chef
module UserContext
def with_user_context(user, password, domain = nil, &block)
- if node["platform_family"] != "windows"
+ unless Chef::Platform.windows?
raise Exceptions::UnsupportedPlatform, "User context impersonation is supported only on the Windows platform"
end
diff --git a/spec/unit/mixin/user_context_spec.rb b/spec/unit/mixin/user_context_spec.rb
index f2119b6dbc..3dadf6a2c3 100644
--- a/spec/unit/mixin/user_context_spec.rb
+++ b/spec/unit/mixin/user_context_spec.rb
@@ -41,7 +41,6 @@ describe "a class that mixes in user_context" do
before do
allow(::Chef::Platform).to receive(:windows?).and_return(true)
allow(::Chef::Util::Windows::LogonSession).to receive(:new).and_return(logon_session)
- allow(instance_with_user_context).to receive(:node).and_return({ "platform_family" => "windows" })
end
let(:logon_session) { instance_double("::Chef::Util::Windows::LogonSession", :set_user_context => nil, :open => nil, :close => nil) }
@@ -99,7 +98,7 @@ describe "a class that mixes in user_context" do
context "when not running on Windows" do
before do
- allow(instance_with_user_context).to receive(:node).and_return({ "platform_family" => "ubuntu" })
+ allow(::Chef::Platform).to receive(:windows?).and_return(false)
end
it "raises a ::Chef::Exceptions::UnsupportedPlatform exception" do
diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb
index 621d2769a4..ecb326fc64 100644
--- a/spec/unit/provider/remote_file/network_file_spec.rb
+++ b/spec/unit/provider/remote_file/network_file_spec.rb
@@ -33,7 +33,7 @@ describe Chef::Provider::RemoteFile::NetworkFile do
let(:source_file) { double("::File", :read => nil) }
before do
- allow(fetcher).to receive(:node).and_return({ "platform_family" => "windows" })
+ allow(Chef::Platform).to receive(:windows?).and_return(true)
end
it "stages the local file to a temporary file" do