summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md7
-rw-r--r--Gemfile.lock24
-rw-r--r--VERSION2
-rw-r--r--chef-bin/lib/chef-bin/version.rb2
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef-utils/lib/chef-utils/dsl/windows.rb22
-rw-r--r--chef-utils/lib/chef-utils/version.rb2
-rw-r--r--chef-utils/spec/unit/dsl/windows_spec.rb42
-rw-r--r--lib/chef/dsl/declare_resource.rb18
-rw-r--r--lib/chef/version.rb2
10 files changed, 83 insertions, 40 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2575d36227..32f112b478 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,16 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 15.7.33 -->
-## [v15.7.33](https://github.com/chef/chef/tree/v15.7.33) (2020-01-28)
+<!-- latest_release 15.8.0 -->
+## [v15.8.0](https://github.com/chef/chef/tree/v15.8.0) (2020-01-31)
#### Merged Pull Requests
-- Fixes all notarization issues [#9252](https://github.com/chef/chef/pull/9252) ([jonsmorrow](https://github.com/jonsmorrow))
+- Add windows_nt_version and powershell_version helpers to chef-utils [#9307](https://github.com/chef/chef/pull/9307) ([tas50](https://github.com/tas50))
<!-- latest_release -->
<!-- release_rollup since=15.7.32 -->
### Changes not yet released to stable channel
#### Merged Pull Requests
+- Add windows_nt_version and powershell_version helpers to chef-utils [#9307](https://github.com/chef/chef/pull/9307) ([tas50](https://github.com/tas50)) <!-- 15.8.0 -->
- Fixes all notarization issues [#9252](https://github.com/chef/chef/pull/9252) ([jonsmorrow](https://github.com/jonsmorrow)) <!-- 15.7.33 -->
<!-- release_rollup -->
diff --git a/Gemfile.lock b/Gemfile.lock
index a2f2be6324..5c85d03326 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -27,12 +27,12 @@ GIT
PATH
remote: .
specs:
- chef (15.7.33)
+ chef (15.8.0)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.7.33)
- chef-utils (= 15.7.33)
+ chef-config (= 15.8.0)
+ chef-utils (= 15.8.0)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -59,12 +59,12 @@ PATH
train-winrm (>= 0.2.5)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (15.7.33-universal-mingw32)
+ chef (15.8.0-universal-mingw32)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.7.33)
- chef-utils (= 15.7.33)
+ chef-config (= 15.8.0)
+ chef-utils (= 15.8.0)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -107,15 +107,15 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (15.7.33)
- chef (= 15.7.33)
+ chef-bin (15.8.0)
+ chef (= 15.8.0)
PATH
remote: chef-config
specs:
- chef-config (15.7.33)
+ chef-config (15.8.0)
addressable
- chef-utils (= 15.7.33)
+ chef-utils (= 15.8.0)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
@@ -124,7 +124,7 @@ PATH
PATH
remote: chef-utils
specs:
- chef-utils (15.7.33)
+ chef-utils (15.8.0)
GEM
remote: https://rubygems.org/
@@ -416,7 +416,7 @@ GEM
win32-ipc (>= 0.6.0)
win32-process (0.8.3)
ffi (>= 1.0.0)
- win32-service (2.1.4)
+ win32-service (2.1.5)
ffi
ffi-win32-extensions
win32-taskscheduler (2.0.4)
diff --git a/VERSION b/VERSION
index 4301744cad..1685f0c162 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-15.7.33 \ No newline at end of file
+15.8.0 \ No newline at end of file
diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb
index f458f39f19..e14e6a9142 100644
--- a/chef-bin/lib/chef-bin/version.rb
+++ b/chef-bin/lib/chef-bin/version.rb
@@ -21,7 +21,7 @@
module ChefBin
CHEFBIN_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "15.7.33".freeze
+ VERSION = "15.8.0".freeze
end
#
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 3dc3acb4e0..21d5b37ef6 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -15,5 +15,5 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "15.7.33".freeze
+ VERSION = "15.8.0".freeze
end
diff --git a/chef-utils/lib/chef-utils/dsl/windows.rb b/chef-utils/lib/chef-utils/dsl/windows.rb
index 86d8fb00bc..904e9ef126 100644
--- a/chef-utils/lib/chef-utils/dsl/windows.rb
+++ b/chef-utils/lib/chef-utils/dsl/windows.rb
@@ -20,6 +20,8 @@ require_relative "../internal"
module ChefUtils
module DSL
module Windows
+ require "chef-utils/version_string"
+
include Internal
# Determine if the current node is Windows Server Core.
@@ -52,6 +54,26 @@ module ChefUtils
node["kernel"]["product_type"] == "Server"
end
+ # Determine the current Windows NT version. The NT version often differs from the marketing version, but offers a good way to find desktop and server releases that are based on the same codebase. IE: NT 6.3 is Windows 8.1 and Windows 2012 R2.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [ChefUtils::VersionString]
+ #
+ def windows_nt_version(node = __getnode)
+ ChefUtils::VersionString.new(node["os_version"])
+ end
+
+ # Determine the installed version of PowerShell
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [ChefUtils::VersionString]
+ #
+ def powershell_version(node = __getnode)
+ ChefUtils::VersionString.new(node["languages"]["powershell"]["version"])
+ end
+
extend self
end
end
diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb
index 30fc92da36..a01e2b2a07 100644
--- a/chef-utils/lib/chef-utils/version.rb
+++ b/chef-utils/lib/chef-utils/version.rb
@@ -15,5 +15,5 @@
module ChefUtils
CHEFUTILS_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "15.7.33".freeze
+ VERSION = "15.8.0".freeze
end
diff --git a/chef-utils/spec/unit/dsl/windows_spec.rb b/chef-utils/spec/unit/dsl/windows_spec.rb
index e069c175ee..08ddb9c118 100644
--- a/chef-utils/spec/unit/dsl/windows_spec.rb
+++ b/chef-utils/spec/unit/dsl/windows_spec.rb
@@ -17,13 +17,15 @@
require "spec_helper"
+WINDOWS_BOOL_HELPERS = %i{windows_server_core? windows_server? windows_workstation?}.freeze
+
def windows_reports_true_for(*args)
args.each do |method|
it "reports true for #{method}" do
expect(described_class.send(method, node)).to be true
end
end
- (WINDOWS_HELPERS - args).each do |method|
+ (WINDOWS_BOOL_HELPERS - args).each do |method|
it "reports false for #{method}" do
expect(described_class.send(method, node)).to be false
end
@@ -43,21 +45,39 @@ RSpec.describe ChefUtils::DSL::Windows do
end
end
- context "on Windows Server Core" do
- let(:node) { { "kernel" => { "server_core" => true } } }
+ context "windows boolean helpers" do
+ context "on Windows Server Core" do
+ let(:node) { { "kernel" => { "server_core" => true } } }
- windows_reports_true_for(:windows_server_core?)
- end
+ windows_reports_true_for(:windows_server_core?)
+ end
+
+ context "on Windows Workstation" do
+ let(:node) { { "kernel" => { "product_type" => "Workstation" } } }
+
+ windows_reports_true_for(:windows_workstation?)
+ end
- context "on Windows Workstation" do
- let(:node) { { "kernel" => { "product_type" => "Workstation" } } }
+ context "on Windows Server" do
+ let(:node) { { "kernel" => { "product_type" => "Server" } } }
- windows_reports_true_for(:windows_workstation?)
+ windows_reports_true_for(:windows_server?)
+ end
end
- context "on Windows Server" do
- let(:node) { { "kernel" => { "product_type" => "Server" } } }
+ context "#windows_nt_version on Windows Server 2012 R2" do
+ let(:node) { { "os_version" => "6.3.9600" } }
+ it "it returns a ChefUtils::VersionString object with 6.3.9600" do
+ expect(described_class.send(:windows_nt_version, node)).to eq "6.3.9600"
+ expect(described_class.send(:windows_nt_version, node)).to be_a_kind_of ChefUtils::VersionString
+ end
+ end
- windows_reports_true_for(:windows_server?)
+ context "#powershell_version on Windows Server 2012 R2" do
+ let(:node) { { "languages" => { "powershell" => { "version" => "4.0" } } } }
+ it "it returns a ChefUtils::VersionString object with 4.0" do
+ expect(described_class.send(:powershell_version, node)).to eq "4.0"
+ expect(described_class.send(:powershell_version, node)).to be_a_kind_of ChefUtils::VersionString
+ end
end
end
diff --git a/lib/chef/dsl/declare_resource.rb b/lib/chef/dsl/declare_resource.rb
index 7ae1551c04..a4272a5f28 100644
--- a/lib/chef/dsl/declare_resource.rb
+++ b/lib/chef/dsl/declare_resource.rb
@@ -69,7 +69,7 @@ class Chef
# @return [Chef::Resource] The resource
#
# @example
- # delete_resource!(:template, '/x/y.txy')
+ # delete_resource!(:template, '/x/y.txt')
#
def delete_resource!(type, name, run_context: self.run_context)
run_context.resource_collection.delete("#{type}[#{name}]").tap do |resource|
@@ -93,7 +93,7 @@ class Chef
# @return [Chef::Resource] The resource
#
# @example
- # delete_resource(:template, '/x/y.txy')
+ # delete_resource(:template, '/x/y.txt')
#
def delete_resource(type, name, run_context: self.run_context)
delete_resource!(type, name, run_context: run_context)
@@ -114,7 +114,7 @@ class Chef
# @return [Chef::Resource] The updated resource
#
# @example
- # edit_resource!(:template, '/x/y.txy') do
+ # edit_resource!(:template, '/x/y.txt') do
# cookbook_name: cookbook_name
# end
#
@@ -147,8 +147,8 @@ class Chef
# @return [Chef::Resource] The updated or created resource
#
# @example
- # resource = edit_resource(:template, '/x/y.txy') do
- # source "y.txy.erb"
+ # resource = edit_resource(:template, '/x/y.txt') do
+ # source "y.txt.erb"
# variables {}
# end
# resource.variables.merge!({ home: "/home/klowns" })
@@ -199,7 +199,7 @@ class Chef
# @return [Chef::Resource] The updated resource
#
# @example
- # resource = find_resource!(:template, '/x/y.txy')
+ # resource = find_resource!(:template, '/x/y.txt')
#
def find_resource!(type, name, run_context: self.run_context)
raise ArgumentError, "find_resource! does not take a block" if block_given?
@@ -219,7 +219,7 @@ class Chef
# @return [Chef::Resource] The updated resource
#
# @example
- # if ( find_resource(:template, '/x/y.txy') )
+ # if ( find_resource(:template, '/x/y.txt') )
# # do something
# else
# # don't worry about the error
@@ -259,7 +259,7 @@ class Chef
# @return [Chef::Resource] The new resource.
#
# @example
- # declare_resource(:file, '/x/y.txy', caller[0]) do
+ # declare_resource(:file, '/x/y.txt', caller[0]) do
# action :delete
# end
# # Equivalent to
@@ -293,7 +293,7 @@ class Chef
# @return [Chef::Resource] The new resource.
#
# @example
- # build_resource(:file, '/x/y.txy', caller[0]) do
+ # build_resource(:file, '/x/y.txt', caller[0]) do
# action :delete
# end
#
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index bc32561e38..1d25dc2d11 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require_relative "version_string"
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = Chef::VersionString.new("15.7.33")
+ VERSION = Chef::VersionString.new("15.8.0")
end
#