summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornimisha <nimisha.sharad@msystechnologies.com>2017-01-20 18:53:27 +0530
committerBryan McLellan <btm@loftninjas.org>2017-01-23 12:49:37 -0500
commit0431b52d3347451f9d1d45fad6c437cff759c97f (patch)
tree6d2b7300056d393878164c0e42e4043980161808
parented18c8de0bfd105fa88a5c1ec2b67d784d9e389a (diff)
downloadchef-btm/4299-rebase.tar.gz
Fixing specsbtm/4299-rebase
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
-rw-r--r--lib/chef/mixin/user_identity.rb2
-rw-r--r--lib/chef/provider/remote_file.rb3
-rw-r--r--spec/functional/resource/msu_package_spec.rb1
-rw-r--r--spec/support/shared/functional/windows_script.rb5
-rw-r--r--spec/support/shared/unit/provider/file.rb1
-rw-r--r--spec/unit/mixin/user_context_spec.rb12
6 files changed, 4 insertions, 20 deletions
diff --git a/lib/chef/mixin/user_identity.rb b/lib/chef/mixin/user_identity.rb
index d527e05e48..bc8626ac65 100644
--- a/lib/chef/mixin/user_identity.rb
+++ b/lib/chef/mixin/user_identity.rb
@@ -54,7 +54,7 @@ class Chef
end
# if domain is provided in both username and domain
- if specified_user && ((specified_user.include? '\\') || (specified_user.include? '@')) && specified_domain
+ if specified_user && ((specified_user.include? '\\') || (specified_user.include? "@")) && specified_domain
raise ArgumentError, "The domain is provided twice. Username: `#{specified_user}`, Domain: `#{specified_domain}`. Please specify domain only once."
end
diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb
index ca85d6e4aa..5f47174605 100644
--- a/lib/chef/provider/remote_file.rb
+++ b/lib/chef/provider/remote_file.rb
@@ -46,8 +46,9 @@ class Chef
def define_resource_requirements
# @todo: this should change to raise in some appropriate major version bump.
requirements.assert(:all_actions) do |a|
- a.assertion { validate_identity(new_resource.user, new_resource.password, new_resource.domain) }
+ a.assertion { validate_identity(new_resource.remote_user, new_resource.remote_user_password, new_resource.remote_user_domain) }
end
+ super
end
private
diff --git a/spec/functional/resource/msu_package_spec.rb b/spec/functional/resource/msu_package_spec.rb
index 23342be6ae..fc0c0583b2 100644
--- a/spec/functional/resource/msu_package_spec.rb
+++ b/spec/functional/resource/msu_package_spec.rb
@@ -23,7 +23,6 @@ describe Chef::Resource::MsuPackage, :win2012r2_only do
let(:package_name) { "Package_for_KB2959977" }
let(:package_source) { "https://download.microsoft.com/download/3/B/3/3B320C07-B7B1-41E5-81F4-79EBC02DF7D3/Windows8.1-KB2959977-x64.msu" }
-
let(:new_resource) { Chef::Resource::CabPackage.new("windows_test_pkg") }
let(:cab_provider) do
node = Chef::Node.new
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 4bd6bdf230..8a9a19d4ad 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -160,11 +160,6 @@ shared_context Chef::Resource::WindowsScript do
end
end
- context "when a different non-admin user attempts read to access the script" do
- let(:file_access_command) { read_access_denied_command }
- it_behaves_like "a script whose file system location cannot be accessed by other non-admin users"
- end
-
context "when a different non-admin user attempts write (modify) to access the script" do
let(:file_access_command) { modify_access_denied_command }
it_behaves_like "a script whose file system location cannot be accessed by other non-admin users"
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index b58159fcc9..8e3f541383 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -413,6 +413,7 @@ shared_examples_for Chef::Provider::File do
end
context "define_resource_requirements" do
+
context "when the enclosing directory does not exist" do
before { setup_missing_enclosing_directory }
diff --git a/spec/unit/mixin/user_context_spec.rb b/spec/unit/mixin/user_context_spec.rb
index 5eeda55f02..640508e237 100644
--- a/spec/unit/mixin/user_context_spec.rb
+++ b/spec/unit/mixin/user_context_spec.rb
@@ -49,22 +49,10 @@ describe "a class that mixes in user_context" do
expect { instance_with_user_context.with_context(nil, nil, nil) {} }.not_to raise_error
end
- it "raises an exception if the user is supplied but not the domain and password" do
- expect { instance_with_user_context.with_context("kamilah", nil, nil) {} }.to raise_error(ArgumentError)
- end
-
it "raises an exception if the domain is supplied but not the user and password" do
expect { instance_with_user_context.with_context(nil, "xanadu", nil) {} }.to raise_error(ArgumentError)
end
- it "raises an exception if the password is supplied but not the user and domain" do
- expect { instance_with_user_context.with_context(nil, nil, "chef4life") {} }.to raise_error(ArgumentError)
- end
-
- it "raises an exception if the user and domain is supplied but the password is not" do
- expect { instance_with_user_context.with_context("kamilah", "xanadu", nil) {} }.to raise_error(ArgumentError)
- end
-
context "when given valid user credentials" do
before do
expect(::Chef::Util::Windows::LogonSession).to receive(:new).and_return(logon_session)