Skip to content

Commit

Permalink
Remove automatic chef client upgrades
Browse files Browse the repository at this point in the history
Until we determine how we want to handle upgrading chef client
on workstation-managed nodes, we have decided to disable the
behavior of automatically upgrading out-of-date chef clients

This changes the wording of CHEFINS003 to reflect that, and
changes the install action so that it will simply raise if
the chef client installation is out of date instead of conditionally
continuing.
  • Loading branch information
marcparadise committed May 10, 2018
1 parent afe1088 commit 84100d6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
15 changes: 7 additions & 8 deletions components/chef-workstation/i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ commands:
cookbook_repo_paths:
desc: "Comma separated list of cookbook repository paths."
install_description: |
Install Chef client on the target host(s) if it is not installed,
or upgrade it if the installed client is older than version %1.
By default, perform the install/upgrade if it is necessary.
Install Chef client on the target host(s) if it is not installed.
This defaults to enabled - the installation will be performed
if there is no Chef client on the target(s).
# Status updates shared across commands.
status:
Expand Down Expand Up @@ -152,18 +153,16 @@ errors:
This command is powered by the Chef client. In order to make use of it
on this node, the Chef client must be installed first.
Re-running this command without the '--no-install' flag will permit
me to automatically perform the installation.
Re-running this command without the '--no-install' flag will
automatically perform the installation.
CHEFINS003: |
The target has an older version of Chef client installed.
The target has version %1 installed, but this command
requires a minimum version of %2.
Re-running this command without the '--no-install' flag will permit
me to automatically upgrade the target to the latest Chef client.
Please upgrade the Chef client on this node to version %2 or later.
# Remote execution and file operation errors are prefixed CHEFRMT
CHEFRMT001: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ def perform_action
notify(:already_installed)
return
end
if config[:check_only]
raise ClientOutdated.new(target_host.installed_chef_version, MIN_CHEF_VERSION)
end
@upgrading = true
perform_local_install
raise ClientOutdated.new(target_host.installed_chef_version, MIN_CHEF_VERSION)
# NOTE: 2018-05-10 below is an intentionally dead code path that
# will get re-visited once we determine how we want automatic
# upgrades to behave.
# @upgrading = true
# perform_local_install
rescue ChefWorkstation::TargetHost::ChefNotInstalled
if config[:check_only]
raise ClientNotInstalled.new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class Converge < ChefWorkstation::Command::Base
:proc => Proc.new { |paths| paths.split(",") }

option :install,
long: "--[no-]install",
default: true,
description: T.install_description(Action::InstallChef::Base::MIN_CHEF_VERSION)
long: "--[no-]install",
default: true,
description: T.install_description(Action::InstallChef::Base::MIN_CHEF_VERSION)

def run(params)
validate_params(cli_arguments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def installed_chef_version
# TODO - use a proper method to query the win installation path -
# currently we're assuming the default, but this can be customized
# at install time.
# A working approach is below - but it runs very slowly in testing
# on a virtualbox windows vm:
# (over winrm) Get-WmiObject Win32_Product | Where {$_.Name -match 'Chef Client'}
windows: "c:\\opscode\\chef\\version-manifest.json",
linux: "/opt/chef/version-manifest.json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
expect(install.target_host).to receive(:installed_chef_version).
and_return Gem::Version.new("12.1.1")
end
it "performs the upgrade" do
# 2018-05-10 pended until we determine how we want auto-upgrades to behave
xit "performs the upgrade" do
expect(install).to receive(:perform_local_install)
install.perform_action
end
Expand Down

0 comments on commit 84100d6

Please sign in to comment.