-
Notifications
You must be signed in to change notification settings - Fork 582
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install Omnibus if require_chef_omnibus version differs from current.
This will allow a user to upgrade or downgrade their Omnibus package version to match the version string in require_chef_omnibus. If the version string matches what is currently installed, the installation is skipped. **Note** This commit also supports a value of `"latest"` for require_chef_omnibus which drops the version flag when calling the omnibus installation script. Since calculating the lastest Chef release is nontrivial, the Omnibus installer will be called on every converge when `"latest"` is set--whether Chef is installed or not. Closes #32
- Loading branch information
Showing
1 changed file
with
15 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,11 +91,23 @@ def chef_home | |
end | ||
|
||
def install_omnibus(ssh_args) | ||
flag = config[:require_chef_omnibus] | ||
version = flag.is_a?(String) ? "-s -- -v #{flag}" : "" | ||
flag = config[:require_chef_omnibus].downcase | ||
version = if flag.is_a?(String) && flag != "latest" | ||
"-s -- -v #{flag}" | ||
else | ||
"" | ||
end | ||
|
||
ssh(ssh_args, <<-INSTALL.gsub(/^ {10}/, '')) | ||
if [ ! -d "/opt/chef" ] ; then | ||
should_update_chef() { | ||
case "#{flag}" in | ||
$(chef-solo --v | awk '{print $2}')) return 1 ;; | ||
latest|*) return 0 ;; | ||
esac | ||
} | ||
if [ ! -d "/opt/chef" ] || should_update_chef ; then | ||
echo '-----> Installing Chef Omnibus (#{flag})' | ||
curl -sSL https://www.opscode.com/chef/install.sh \ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
fnichol
Author
Contributor
|
||
| sudo bash #{version} | ||
fi | ||
|
I'm wondering if this should be
wget -O - https://www.opscode.com/chef/install.sh
as curl is not a default package on many platforms.