summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-04-02 12:32:08 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-02 12:33:02 -0700
commit115b0a82fdaff1e973c1c3572814c42d2b252117 (patch)
treed1c6064022da796b5378e5be76a3e352a8b49825
parentfda3d15113e1ccee446cb37375ae6533c1d08024 (diff)
downloadchef-115b0a82fdaff1e973c1c3572814c42d2b252117.tar.gz
Revert the :upgrade action portion of the Chef 16 PR
That's a breaking change we don't want to introduce. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/build_essential.rb44
1 files changed, 13 insertions, 31 deletions
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 0944805653..ba264495de 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -37,13 +37,6 @@ class Chef
compile_time true
end
```
-
- Upgrade compilation packages on macOS systems
- ```ruby
- build_essential 'Install compilation tools' do
- action :upgrade
- end
- ```
DOC
# this allows us to use build_essential without setting a name
@@ -132,20 +125,6 @@ class Chef
end
end
- action :upgrade do
- description "Upgrade build essential (Xcode Command Line) tools on macOS"
-
- if macos?
- pkg_label = xcode_cli_package_label
-
- # With upgrade action we should install if it's not installed or if there's an available update.
- # `xcode_cli_package_label` will be nil if there's no update.
- install_xcode_cli_tools(pkg_label) if !xcode_cli_installed? || xcode_cli_package_label
- else
- Chef::Log.info "The build_essential resource :upgrade action is only supported on macOS systems. Skipping..."
- end
- end
-
action_class do
#
# Install Xcode Command Line tools via softwareupdate CLI
@@ -155,16 +134,19 @@ class Chef
def install_xcode_cli_tools(label)
# This script was graciously borrowed and modified from Tim Sutton's
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
- execute "install Xcode Command Line tools" do
- command <<-EOH
- # create the placeholder file that's checked by CLI updates' .dist code
- # in Apple's SUS catalog
- touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
- # install it
- softwareupdate -i "#{label}" --verbose
- # Remove the placeholder to prevent perpetual appearance in the update utility
- rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
- EOH
+
+ if label.nil?
+ Chef::Log.warn("Could not determine a Xcode CLI Tools package to install via softwareupdate")
+ else
+ # create the placeholder file that's checked by CLI updates' .dist code
+ # in Apple's SUS catalog and then remove it when we're done
+ execute "install Xcode Command Line tools" do
+ command <<-EOH
+ touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
+ softwareupdate -i "#{label}" --verbose
+ rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
+ EOH
+ end
end
end