diff options
author | nimisha <nimisha.sharad@msystechnologies.com> | 2017-02-23 19:18:19 +0530 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-09-05 20:09:30 -0400 |
commit | 35f4cafac60770b59853d7e12b418f1971d234db (patch) | |
tree | eb7278490f1cae24b74558477e7fe57248f138be /lib/chef/util | |
parent | 16ebc075e6214da2ad482bf9ffa74a4d5ae80b12 (diff) | |
download | chef-35f4cafac60770b59853d7e12b418f1971d234db.tar.gz |
Added define_resource_requirement and some other validations
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
Diffstat (limited to 'lib/chef/util')
-rw-r--r-- | lib/chef/util/windows/logon_session.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/util/windows/logon_session.rb b/lib/chef/util/windows/logon_session.rb index cf0a8000ef..6ef49e96a3 100644 --- a/lib/chef/util/windows/logon_session.rb +++ b/lib/chef/util/windows/logon_session.rb @@ -49,7 +49,7 @@ class Chef status = Chef::ReservedNames::Win32::API::Security.LogonUserW(username, domain, password, Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NETWORK, Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT, token) - if status == 0 + if !status last_error = FFI::LastError.error raise Chef::Exceptions::Win32APIError, "Logon for user `#{original_username}` failed with Win32 status #{last_error}." end @@ -82,7 +82,7 @@ class Chef status = Chef::ReservedNames::Win32::API::Security.ImpersonateLoggedOnUser(token.read_ulong) - if status == 0 + if !status last_error = FFI::LastError.error raise Chef::Exceptions::Win32APIError, "Attempt to impersonate user `#{original_username}` failed with Win32 status #{last_error}." end @@ -96,7 +96,7 @@ class Chef if impersonating status = Chef::ReservedNames::Win32::API::Security.RevertToSelf - if status == 0 + if !status last_error = FFI::LastError.error raise Chef::Exceptions::Win32APIError, "Unable to restore user context with Win32 status #{last_error}." end |