Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Parse version with "Chef Infra Client: x.y.z" format #540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/chef/knife/solo_cook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ def chef_version_satisfies?(requirement)
Gem::Requirement.new(requirement).satisfied_by? Gem::Version.new(chef_version)
end

# Parses "Chef: x.y.z" from the chef-solo version output
# Parses "Chef: x.y.z" and "Chef Infra Client: x.y.z" from the chef-solo version output
def chef_version
# Memoize the version to avoid multiple SSH calls
@chef_version ||= lambda do
cmd = %q{sudo chef-solo --version 2>/dev/null | awk '$1 == "Chef:" {print $2}'}
cmd = %q{sudo chef-solo --version 2>/dev/null | awk -F ": " '/Chef/{print $2}'}
run_command(cmd).stdout.strip
end.call
end
Expand Down