diff options
author | Salim Alam <salam@chef.io> | 2015-09-17 18:53:09 -0700 |
---|---|---|
committer | Salim Alam <salam@chef.io> | 2015-09-22 12:03:51 -0700 |
commit | 9efa0d89d2c344c1b383626ad6ffc56169bde5c9 (patch) | |
tree | a92a042e2f26739abc1cb0aa2080b33bac58bdae /lib/chef/platform | |
parent | aa01ffbc92de80114089d8fa2ea7d072d0fb2e74 (diff) | |
download | chef-9efa0d89d2c344c1b383626ad6ffc56169bde5c9.tar.gz |
Lazy load MSI provider, add check for MSI supportsalam/lazy-msi
Diffstat (limited to 'lib/chef/platform')
-rw-r--r-- | lib/chef/platform/query_helpers.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb index 9ba8d2261d..dfb99ed750 100644 --- a/lib/chef/platform/query_helpers.rb +++ b/lib/chef/platform/query_helpers.rb @@ -58,6 +58,22 @@ class Chef return nano == 1 end + def supports_msi? + return false unless windows? + require 'win32/registry' + + key = "System\\CurrentControlSet\\Services\\msiserver" + access = ::Win32::Registry::KEY_QUERY_VALUE + + begin + ::Win32::Registry::HKEY_LOCAL_MACHINE.open(key, access) do |reg| + true + end + rescue ::Win32::Registry::Error + false + end + end + def supports_powershell_execution_bypass?(node) node[:languages] && node[:languages][:powershell] && node[:languages][:powershell][:version].to_i >= 3 |