summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-10-16 10:14:56 -0700
committerClaire McQuin <claire@getchef.com>2014-10-16 10:14:56 -0700
commit1da210f48c60460bad494d4cc28d1385407e0806 (patch)
treea7d5ded97dca7a645491d92e41da31a21208cca8 /lib
parent9af87953f6b4fe40c84e902d19b880138465044d (diff)
parentb80ababcfe48bb53bf745100d18a55381c6a9f45 (diff)
downloadchef-1da210f48c60460bad494d4cc28d1385407e0806.tar.gz
Merge branch 'master' into mcquin/centos-locale-a
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/mixin/homebrew_user.rb2
-rw-r--r--lib/chef/mixin/shell_out.rb4
-rw-r--r--lib/chef/provider/dsc_script.rb5
-rw-r--r--lib/chef/provider/package/homebrew.rb2
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb6
-rw-r--r--lib/chef/win32/version.rb2
6 files changed, 9 insertions, 12 deletions
diff --git a/lib/chef/mixin/homebrew_user.rb b/lib/chef/mixin/homebrew_user.rb
index 854a954a90..ab6fb19563 100644
--- a/lib/chef/mixin/homebrew_user.rb
+++ b/lib/chef/mixin/homebrew_user.rb
@@ -36,7 +36,7 @@ class Chef
# the brew executable.
def find_homebrew_uid(provided_user = nil)
# They could provide us a user name or a UID
- unless provided_user.nil?
+ if provided_user
return provided_user if provided_user.is_a? Integer
return Etc.getpwnam(provided_user).uid
end
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb
index 82772b584a..5b05e788db 100644
--- a/lib/chef/mixin/shell_out.rb
+++ b/lib/chef/mixin/shell_out.rb
@@ -15,10 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# chef/shell_out has been deprecated in favor of mixlib/shellout
-# chef/shell_out is still required here to ensure backward compatibility
-require 'chef/shell_out'
-
require 'mixlib/shellout'
class Chef
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index b8ca54f1b8..a70f4b5048 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -62,7 +62,7 @@ class Chef
def define_resource_requirements
requirements.assert(:run) do |a|
err = [
- 'Could not find Dsc on the system',
+ 'Could not find PowerShell DSC support on the system',
powershell_info_str,
"Powershell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
]
@@ -98,9 +98,8 @@ class Chef
end
def get_augmented_configuration_flags(configuration_data_path)
- updated_flags = nil
+ updated_flags = @dsc_resource.flags.nil? ? {} : @dsc_resource.flags.dup
if configuration_data_path
- updated_flags = @dsc_resource.flags.nil? ? {} : @dsc_resource.flags.dup
Chef::Util::PathHelper.validate_path(configuration_data_path)
updated_flags[:configurationdata] = configuration_data_path
end
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index 202e4d2533..a9aeea1415 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -109,7 +109,7 @@ class Chef
private
def get_response_from_command(command)
- homebrew_uid = find_homebrew_uid(new_resource.homebrew_user)
+ homebrew_uid = find_homebrew_uid(new_resource.respond_to?(:homebrew_user) && new_resource.homebrew_user)
homebrew_user = Etc.getpwuid(homebrew_uid)
Chef::Log.debug "Executing '#{command}' as user '#{homebrew_user.name}'"
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index 4a56b6a397..7395dd5bbf 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -29,7 +29,7 @@ class Chef::Util::DSC
def test_configuration(configuration_document)
status = run_configuration_cmdlet(configuration_document)
- handle_what_if_exception!(status.stderr) unless status.succeeded?
+ log_what_if_exception(status.stderr) unless status.succeeded?
configuration_update_required?(status.return_value)
end
@@ -78,14 +78,14 @@ $ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path #{@configu
EOH
end
- def handle_what_if_exception!(what_if_exception_output)
+ def log_what_if_exception(what_if_exception_output)
if what_if_exception_output.gsub(/\s+/, ' ') =~ /A parameter cannot be found that matches parameter name 'Whatif'/i
# LCM returns an error if any of the resources do not support the opptional What-If
Chef::Log::warn("Received error while testing configuration due to resource not supporting 'WhatIf'")
elsif output_has_dsc_module_failure?(what_if_exception_output)
Chef::Log::warn("Received error while testing configuration due to a module for an imported resource possibly not being fully installed:\n#{what_if_exception_output.gsub(/\s+/, ' ')}")
else
- raise Chef::Exceptions::PowershellCmdletException, "Powershell Cmdlet failed: #{what_if_exception_output.gsub(/\s+/, ' ')}"
+ Chef::Log::warn("Received error while testing configuration:\n#{what_if_exception_output.gsub(/\s+/, ' ')}")
end
end
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index d2138289f5..d16bd8c12f 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -48,6 +48,8 @@ class Chef
public
WIN_VERSIONS = {
+ "Windows 10" => {:major => 6, :minor => 4, :callable => lambda{ |product_type, suite_mask| product_type == VER_NT_WORKSTATION }},
+ "Windows Server 10" => {:major => 6, :minor => 4, :callable => lambda {|product_type, suite_mask| product_type != VER_NT_WORKSTATION }},
"Windows 8.1" => {:major => 6, :minor => 3, :callable => lambda{ |product_type, suite_mask| product_type == VER_NT_WORKSTATION }},
"Windows Server 2012 R2" => {:major => 6, :minor => 3, :callable => lambda {|product_type, suite_mask| product_type != VER_NT_WORKSTATION }},
"Windows 8" => {:major => 6, :minor => 2, :callable => lambda{ |product_type, suite_mask| product_type == VER_NT_WORKSTATION }},