summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-02-28 12:14:56 -0800
committerTim Smith <tsmith84@gmail.com>2020-02-28 12:15:42 -0800
commitf9987b12ce8b988251b651d10ec2a479756c3e2e (patch)
tree30e6b7b4ff513c5c3b0bf17bb31c7885ee776407 /lib/chef
parent7b7d1556dfdcbec9b78334b89ec8fae35e709fc0 (diff)
downloadchef-f9987b12ce8b988251b651d10ec2a479756c3e2e.tar.gz
Remove all the code that checks for Windows Nanonano_support
Windows Nano isn't a thing anymore so we shouldn't spending compute time checking to see if we're on Windows Nano Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/config.rb2
-rw-r--r--lib/chef/platform/query_helpers.rb22
-rw-r--r--lib/chef/provider/powershell_script.rb9
-rw-r--r--lib/chef/resource/powershell_script.rb2
-rw-r--r--lib/chef/resource/windows_script.rb5
5 files changed, 5 insertions, 35 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index 6964d37abe..f204711384 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -56,7 +56,7 @@ class Chef
default :event_loggers do
evt_loggers = []
- if ChefUtils.windows? && !Chef::Platform.windows_nano_server?
+ if ChefUtils.windows?
evt_loggers << :win_evt
end
evt_loggers
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb
index 3cce4b5d2c..1ddbe09bf4 100644
--- a/lib/chef/platform/query_helpers.rb
+++ b/lib/chef/platform/query_helpers.rb
@@ -26,27 +26,9 @@ class Chef
ChefUtils.windows?
end
+ # @deprecated Windows Nano is not a thing anymore so this check shouldn't be used
def windows_nano_server?
- return false unless windows?
-
- require "win32/registry" unless defined?(Win32::Registry)
-
- # This method may be called before ohai runs (e.g., it may be used to
- # determine settings in config.rb). Chef::Win32::Registry.new uses
- # node attributes to verify the machine architecture which aren't
- # accessible before ohai runs.
- nano = nil
- key = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Server\\ServerLevels"
- access = ::Win32::Registry::KEY_QUERY_VALUE | 0x0100 # nano is 64-bit only
- begin
- ::Win32::Registry::HKEY_LOCAL_MACHINE.open(key, access) do |reg|
- nano = reg["NanoServer"]
- end
- rescue ::Win32::Registry::Error
- # If accessing the registry key failed, then we're probably not on
- # nano. Fail through.
- end
- nano == 1
+ false
end
def supports_msi?
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index 418948e614..9cb807d3a9 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -47,14 +47,7 @@ class Chef
# error status of a failed Windows process that ran at the
# end of the script, it gets changed to '1'.
#
- # Nano only supports -Command
- cmd = "\"#{interpreter_path}\" #{new_resource.flags}"
- if Chef::Platform.windows_nano_server?
- cmd << " -Command \". '#{script_file.path}'\""
- else
- cmd << " -File \"#{script_file.path}\""
- end
- cmd
+ "\"#{interpreter_path}\" #{new_resource.flags} -File \"#{script_file.path}\""
end
protected
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index 6cb1453376..154655f4d9 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -72,8 +72,6 @@ class Chef
# Options that will be passed to Windows PowerShell command
def default_flags
- return "" if Chef::Platform.windows_nano_server?
-
# Execution policy 'Bypass' is preferable since it doesn't require
# user input confirmation for files such as PowerShell modules
# downloaded from the Internet. However, 'Bypass' is not supported
diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb
index f17b3e31c9..dd146deecc 100644
--- a/lib/chef/resource/windows_script.rb
+++ b/lib/chef/resource/windows_script.rb
@@ -54,10 +54,7 @@ class Chef
protected
def assert_architecture_compatible!(desired_architecture)
- if desired_architecture == :i386 && Chef::Platform.windows_nano_server?
- raise Chef::Exceptions::Win32ArchitectureIncorrect,
- "cannot execute script with requested architecture 'i386' on Windows Nano Server"
- elsif ! node_supports_windows_architecture?(node, desired_architecture)
+ unless node_supports_windows_architecture?(node, desired_architecture)
raise Chef::Exceptions::Win32ArchitectureIncorrect,
"cannot execute script with requested architecture '#{desired_architecture}' on a system with architecture '#{node_windows_architecture(node)}'"
end