summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBapu L <bapu.labade@progress.com>2022-06-27 18:46:48 +0530
committerBapu L <bapu.labade@progress.com>2022-06-27 18:46:48 +0530
commit8c139ab355803a3487f91cd89121a57731a5f3e6 (patch)
treeeab072e096c46988b8bb7665dbae812a466ae2a1
parent7ba79354d064144dfa544fd3b45fc3445cbd0bfa (diff)
parentf2a10272c29c80c06143d094c87f182827de12c5 (diff)
downloadchef-8c139ab355803a3487f91cd89121a57731a5f3e6.tar.gz
Merge branch 'main' into fix_desired_state_issue
-rw-r--r--CHANGELOG.md10
-rw-r--r--Gemfile.lock28
-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/version.rb2
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/linux.rb2
-rw-r--r--knife/lib/chef/knife/version.rb2
-rw-r--r--lib/chef/resource/windows_pagefile.rb48
-rw-r--r--lib/chef/version.rb2
-rw-r--r--spec/functional/resource/windows_pagefile_spec.rb35
-rw-r--r--spec/integration/client/client_spec.rb14
12 files changed, 93 insertions, 56 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 794a861c32..d1ed6c431d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,17 +1,21 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
This changelog lists individual merged pull requests to Chef Infra Client and geared towards developers. For a list of significant changes per release see the [Chef Infra Client Release Notes](https://docs.chef.io/release_notes_client/).
-<!-- latest_release 18.0.120 -->
-## [v18.0.120](https://github.com/chef/chef/tree/v18.0.120) (2022-06-14)
+<!-- latest_release 18.0.124 -->
+## [v18.0.124](https://github.com/chef/chef/tree/v18.0.124) (2022-06-25)
#### Merged Pull Requests
-- Updated Ruby version in omnibus_overrides [#12995](https://github.com/chef/chef/pull/12995) ([johnmccrae](https://github.com/johnmccrae))
+- AdHoc Pipeline Windows PageFile Test errors [#13009](https://github.com/chef/chef/pull/13009) ([johnmccrae](https://github.com/johnmccrae))
<!-- latest_release -->
<!-- release_rollup since=17.9.26 -->
### Changes not yet released to stable
#### Merged Pull Requests
+- AdHoc Pipeline Windows PageFile Test errors [#13009](https://github.com/chef/chef/pull/13009) ([johnmccrae](https://github.com/johnmccrae)) <!-- 18.0.124 -->
+- Fix fedora kitchen test failure [#13020](https://github.com/chef/chef/pull/13020) ([neha-p6](https://github.com/neha-p6)) <!-- 18.0.123 -->
+- Refactored tests for older Windows versions [#13019](https://github.com/chef/chef/pull/13019) ([johnmccrae](https://github.com/johnmccrae)) <!-- 18.0.122 -->
+- Correcting Cert creation for rspec tests [#13010](https://github.com/chef/chef/pull/13010) ([johnmccrae](https://github.com/johnmccrae)) <!-- 18.0.121 -->
- Updated Ruby version in omnibus_overrides [#12995](https://github.com/chef/chef/pull/12995) ([johnmccrae](https://github.com/johnmccrae)) <!-- 18.0.120 -->
- Fix documentation for chef_client_scheduled_task [#12917](https://github.com/chef/chef/pull/12917) ([williamtheaker](https://github.com/williamtheaker)) <!-- 18.0.119 -->
- Zypper package source property addition [#12182](https://github.com/chef/chef/pull/12182) ([manick-vel-11](https://github.com/manick-vel-11)) <!-- 18.0.118 -->
diff --git a/Gemfile.lock b/Gemfile.lock
index b38c7b6af9..763f9c7bbf 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -42,12 +42,12 @@ GIT
PATH
remote: .
specs:
- chef (18.0.120)
+ chef (18.0.124)
addressable
aws-sdk-s3 (~> 1.91)
aws-sdk-secretsmanager (~> 1.46)
- chef-config (= 18.0.120)
- chef-utils (= 18.0.120)
+ chef-config (= 18.0.124)
+ chef-utils (= 18.0.124)
chef-vault
chef-zero (>= 14.0.11)
corefoundation (~> 0.3.4)
@@ -76,13 +76,13 @@ PATH
unf_ext (< 0.0.8.1)
uuidtools (>= 2.1.5, < 3.0)
vault (~> 0.16)
- chef (18.0.120-universal-mingw32)
+ chef (18.0.124-universal-mingw32)
addressable
aws-sdk-s3 (~> 1.91)
aws-sdk-secretsmanager (~> 1.46)
- chef-config (= 18.0.120)
+ chef-config (= 18.0.124)
chef-powershell (~> 1.0.12)
- chef-utils (= 18.0.120)
+ chef-utils (= 18.0.124)
chef-vault
chef-zero (>= 14.0.11)
corefoundation (~> 0.3.4)
@@ -126,15 +126,15 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (18.0.120)
- chef (= 18.0.120)
+ chef-bin (18.0.124)
+ chef (= 18.0.124)
PATH
remote: chef-config
specs:
- chef-config (18.0.120)
+ chef-config (18.0.124)
addressable
- chef-utils (= 18.0.120)
+ chef-utils (= 18.0.124)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
@@ -143,7 +143,7 @@ PATH
PATH
remote: chef-utils
specs:
- chef-utils (18.0.120)
+ chef-utils (18.0.124)
concurrent-ruby
GEM
@@ -156,8 +156,8 @@ GEM
mixlib-shellout (>= 2.0, < 4.0)
ast (2.4.2)
aws-eventstream (1.2.0)
- aws-partitions (1.598.0)
- aws-sdk-core (3.131.1)
+ aws-partitions (1.601.0)
+ aws-sdk-core (3.131.2)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
@@ -169,7 +169,7 @@ GEM
aws-sdk-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
- aws-sdk-secretsmanager (1.62.0)
+ aws-sdk-secretsmanager (1.64.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.5.0)
diff --git a/VERSION b/VERSION
index 003084cd89..759872df52 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-18.0.120 \ No newline at end of file
+18.0.124 \ 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 e9bd0bd6c0..3eb13734f2 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("..", __dir__)
- VERSION = "18.0.120".freeze
+ VERSION = "18.0.124".freeze
end
#
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 9d85d315e3..06ffd927fc 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("..", __dir__)
- VERSION = "18.0.120".freeze
+ VERSION = "18.0.124".freeze
end
diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb
index 6b74b744f5..f9b73168a0 100644
--- a/chef-utils/lib/chef-utils/version.rb
+++ b/chef-utils/lib/chef-utils/version.rb
@@ -16,5 +16,5 @@
module ChefUtils
CHEFUTILS_ROOT = File.expand_path("..", __dir__)
- VERSION = "18.0.120"
+ VERSION = "18.0.124"
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
index eb4f4fe546..079f66f511 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
@@ -61,7 +61,7 @@ ssh_known_hosts_entry "github.com"
include_recipe "openssh"
-include_recipe "nscd"
+include_recipe "nscd" unless fedora? # fedora 34+ doesn't have nscd
logrotate_package "logrotate"
diff --git a/knife/lib/chef/knife/version.rb b/knife/lib/chef/knife/version.rb
index 332c1ed98f..709c78e18b 100644
--- a/knife/lib/chef/knife/version.rb
+++ b/knife/lib/chef/knife/version.rb
@@ -17,7 +17,7 @@
class Chef
class Knife
KNIFE_ROOT = File.expand_path("../..", __dir__)
- VERSION = "18.0.120".freeze
+ VERSION = "18.0.124".freeze
end
end
diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb
index 03649e28aa..543170a70e 100644
--- a/lib/chef/resource/windows_pagefile.rb
+++ b/lib/chef/resource/windows_pagefile.rb
@@ -87,7 +87,7 @@ class Chef
if automatic_managed
set_automatic_managed unless automatic_managed?
elsif automatic_managed == false
- unset_automatic_managed if automatic_managed?
+ unset_automatic_managed
else
pagefile = clarify_pagefile_name
initial_size = new_resource.initial_size
@@ -148,10 +148,12 @@ class Chef
def exists?(pagefile)
@exists ||= begin
logger.trace("Checking if #{pagefile} exists by running: Get-CimInstance Win32_PagefileSetting | Where-Object { $_.name -eq $($pagefile)} ")
- cmd = "$page_file_name = '#{pagefile}';"
- cmd << "$pagefile = Get-CimInstance Win32_PagefileSetting | Where-Object { $_.name -eq $($page_file_name)};"
- cmd << "if ([string]::IsNullOrEmpty($pagefile)) { return $false } else { return $true }"
- powershell_exec!(cmd).result
+ powershell_code = <<~CODE
+ $page_file_name = '#{pagefile}';
+ $pagefile = Get-CimInstance Win32_PagefileSetting | Where-Object { $_.name -eq $($page_file_name)}
+ if ([string]::IsNullOrEmpty($pagefile)) { return $false } else { return $true }
+ CODE
+ powershell_exec!(powershell_code).result
end
end
@@ -163,13 +165,16 @@ class Chef
# @return [Boolean]
def max_and_min_set?(pagefile, min, max)
logger.trace("Checking if #{pagefile} has max and initial disk size values set")
- cmd = "$page_file = '#{pagefile}';"
- cmd << "$driveLetter = $page_file.split(':')[0];"
- cmd << "$page_file_settings = Get-CimInstance -ClassName Win32_PageFileSetting -Filter \"SettingID='pagefile.sys @ $($driveLetter):'\" -Property * -ErrorAction Stop;"
- cmd << "if ($page_file_settings.InitialSize -eq #{min} -and $page_file_settings.MaximumSize -eq #{max})"
- cmd << "{ return $true }"
- cmd << "else { return $false }"
- powershell_exec!(cmd).result
+ powershell_code = <<-CODE
+ $page_file = '#{pagefile}';
+ $driveLetter = $page_file.split(':')[0];
+ $page_file_settings = Get-CimInstance -ClassName Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveLetter):'" -Property * -ErrorAction Stop;
+ if ($page_file_settings.InitialSize -eq #{min} -and $page_file_settings.MaximumSize -eq #{max})
+ { return $true }
+ else
+ { return $false }
+ CODE
+ powershell_exec!(powershell_code).result
end
# create a pagefile
@@ -224,12 +229,14 @@ class Chef
# turn off automatic management of all pagefiles by Windows
def unset_automatic_managed
- converge_by("Turn off Automatically Managed on pagefiles") do
- logger.trace("Running Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru")
- powershell_exec! <<~EOH
- $sys = Get-CimInstance Win32_ComputerSystem -Property *
- Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru
- EOH
+ if automatic_managed?
+ converge_by("Turn off Automatically Managed on pagefiles") do
+ logger.trace("Running Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru")
+ powershell_exec! <<~EOH
+ $sys = Get-CimInstance Win32_ComputerSystem -Property *
+ Set-CimInstance -InputObject $sys -Property @{AutomaticManagedPagefile=$false} -PassThru
+ EOH
+ end
end
end
@@ -239,14 +246,13 @@ class Chef
# @param [String] min the minimum size of the pagefile
# @param [String] max the minimum size of the pagefile
def set_custom_size(pagefile, min, max)
+ unset_automatic_managed
converge_by("set #{pagefile} to InitialSize=#{min} & MaximumSize=#{max}") do
logger.trace("Set-CimInstance -Property @{InitialSize = #{min} MaximumSize = #{max}")
powershell_exec! <<~EOD
$page_file = "#{pagefile}"
$driveLetter = $page_file.split(':')[0]
- Get-CimInstance -ClassName Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveLetter):'" -ErrorAction Stop | Set-CimInstance -Property @{
- InitialSize = #{min}
- MaximumSize = #{max}}
+ Get-CimInstance -ClassName Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveLetter):'" -ErrorAction Stop | Set-CimInstance -Property @{InitialSize = #{min}; MaximumSize = #{max};}
EOD
end
end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index ce79005199..8e07067d85 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("..", __dir__)
- VERSION = Chef::VersionString.new("18.0.120")
+ VERSION = Chef::VersionString.new("18.0.124")
end
#
diff --git a/spec/functional/resource/windows_pagefile_spec.rb b/spec/functional/resource/windows_pagefile_spec.rb
index fd44c01973..9e4abc7e58 100644
--- a/spec/functional/resource/windows_pagefile_spec.rb
+++ b/spec/functional/resource/windows_pagefile_spec.rb
@@ -40,13 +40,32 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
new_resource
end
+ def set_automatic_managed_to_false
+ powershell_code = <<~EOH
+ $computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges;
+ $computersys.AutomaticManagedPagefile = $False;
+ $computersys.Put();
+ EOH
+ powershell_exec!(powershell_code)
+ end
+
+ def set_automatic_managed_to_true
+ powershell_code = <<~EOH
+ $computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges;
+ $computersys.AutomaticManagedPagefile = $True;
+ $computersys.Put();
+ EOH
+ powershell_exec!(powershell_code)
+ end
+
describe "Setting Up Pagefile Management" do
context "Disable Automatic Management" do
- it "Disables Automatic Management" do
+ it "Verifies Automatic Management is Disabled" do
+ set_automatic_managed_to_false
subject.path c_path
subject.automatic_managed false
subject.run_action(:set)
- expect(subject).to be_updated_by_last_action
+ expect(subject).not_to be_updated_by_last_action
end
it "Enable Automatic Management " do
@@ -55,6 +74,14 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
subject.run_action(:set)
expect(subject).to be_updated_by_last_action
end
+
+ it "Disables Automatic Management" do
+ set_automatic_managed_to_true
+ subject.path c_path
+ subject.automatic_managed false
+ subject.run_action(:set)
+ expect(subject).to be_updated_by_last_action
+ end
end
end
@@ -69,8 +96,8 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
context "Update a pagefile" do
it "Changes a pagefile to use custom sizes" do
subject.path c_path
- subject.initial_size 20000
- subject.maximum_size 80000
+ subject.initial_size 128
+ subject.maximum_size 512
subject.run_action(:set)
expect(subject).to be_updated_by_last_action
end
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index d2b79edf05..1bd84fa940 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -38,7 +38,7 @@ describe "chef-client" do
def install_certificate_in_store(client_name)
if ChefUtils.windows?
powershell_exec! <<~EOH
- if (-not ($PSVersionTable.PSVersion.Major -ge 5)) {
+ if (-not (($PSVersionTable.PSVersion.Major -ge 5) -and ($PSVersionTable.PSVersion.Build -ge 22000)) ) {
New-SelfSignedCertificate -CertStoreLocation Cert:\\LocalMachine\\My -DnsName "#{client_name}"
}
else {
@@ -72,13 +72,13 @@ describe "chef-client" do
def verify_export_password_exists
powershell_exec! <<~EOH
- Try {
- $response = Get-ItemPropertyValue -Path "HKLM:\\Software\\Progress\\Authentication" -Name "PfxPass" -ErrorAction Stop
- if ($response) {return $true}
- }
- Catch {
- return $false
+ Try {
+ $response = Get-ItemProperty -Path "HKLM:\\Software\\Progress\\Authentication" -Name "PfxPass" -ErrorAction Stop
+ if ($response) {return $true}
}
+ Catch {
+ return $false
+ }
EOH
end