This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(setup): add chef version configuration option
This is based on a work done by @inopinatus here: <https://github.com/inopinatus/chef-upgrade>. Introduces new node parameter `chef-version`, which allows to update chef version on an opsworks instance.
- Loading branch information
Showing
9 changed files
with
132 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
# Original package: <https://github.com/inopinatus/chef-upgrade> | ||
|
||
# Extend the Debian package providers & resources to guard against inadvertent downgrade | ||
shim = Module.new do | ||
def target_version_already_installed?(current_version, target_version) | ||
return super unless @new_resource.downgrade_guard | ||
return false unless current_version && target_version | ||
|
||
Chef::Log.info("#{@new_resource} downgrade guard, comparing current=#{current_version} to target=#{target_version}") | ||
!shell_out('dpkg', '--compare-versions', current_version.to_s, 'ge', target_version.to_s).error? | ||
end | ||
end | ||
|
||
Chef::Provider::Package::Dpkg.prepend shim | ||
Chef::Resource::DpkgPackage.property :downgrade_guard, [true, false], default: true | ||
|
||
Chef::Provider::Package::Apt.prepend shim | ||
Chef::Resource::AptPackage.property :downgrade_guard, [true, false], default: true | ||
|
||
Ohai.plugin(:DebianDowngradeProtectionPlugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters