diff options
author | Claire McQuin <claire@getchef.com> | 2015-09-17 09:47:08 -0700 |
---|---|---|
committer | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2015-09-18 13:18:23 -0400 |
commit | 9703782bad3ddfad90b21ca5a225d4bd2e393f0d (patch) | |
tree | fff6a404d4be3764e5f50c95a1160b85dc452acc /lib/chef/platform | |
parent | 2cadf9cd40e4c19741121bf2df180941918107bb (diff) | |
download | chef-9703782bad3ddfad90b21ca5a225d4bd2e393f0d.tar.gz |
Don't add win_evt logger when on nano.
Diffstat (limited to 'lib/chef/platform')
-rw-r--r-- | lib/chef/platform/query_helpers.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb index 2dd33ea190..9ba8d2261d 100644 --- a/lib/chef/platform/query_helpers.rb +++ b/lib/chef/platform/query_helpers.rb @@ -36,6 +36,28 @@ class Chef is_server_2003 end + def windows_nano_server? + return false unless windows? + require '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 + return nano == 1 + end + def supports_powershell_execution_bypass?(node) node[:languages] && node[:languages][:powershell] && node[:languages][:powershell][:version].to_i >= 3 @@ -52,7 +74,7 @@ class Chef Gem::Version.new(node[:languages][:powershell][:version]) >= Gem::Version.new("5.0.10018.0") end - + def dsc_refresh_mode_disabled?(node) require 'chef/util/powershell/cmdlet' cmdlet = Chef::Util::Powershell::Cmdlet.new(node, "Get-DscLocalConfigurationManager", :object) |