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

Commit

Permalink
Parse version with "Chef Infra Client: x.y.z" format
Browse files Browse the repository at this point in the history
  • Loading branch information
Haluk Durmus committed May 26, 2020
1 parent a6b8a82 commit 1b3d719
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 1b3d719

Please sign in to comment.