diff options
author | Nimisha Sharad <nimisha.sharad@msystechnologies.com> | 2017-07-26 21:55:32 +0530 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-07-26 12:25:32 -0400 |
commit | c2047dde3ecd39188ac3fd5e367613d0b5e4af64 (patch) | |
tree | 4963e50ca89399a9224360169662c08cd47daba9 /lib/chef/resource | |
parent | 7d7cb3e3d7a22908e80dcd8f8541e5537a1b1629 (diff) | |
download | chef-c2047dde3ecd39188ac3fd5e367613d0b5e4af64.tar.gz |
[MSYS-629] Added username/password validation for elevated option (#6293)
* Added username/password validation for elevated option with specs
Signed-off-by: nimisha <nimisha.sharad@clogeny.com>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r-- | lib/chef/resource/execute.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index 32198e5db0..ba1b8ae6e3 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -162,6 +162,10 @@ class Chef if specified_user && password.nil? raise ArgumentError, "A value for `password` must be specified when a value for `user` is specified on the Windows platform" end + + if elevated && !specified_user && !password + raise ArgumentError, "`elevated` option should be passed only with `username` and `password`." + end else if password || specified_domain raise Exceptions::UnsupportedPlatform, "Values for `domain` and `password` are only supported on the Windows platform" |