Skip to content

Commit

Permalink
Add test for rancher plist file sync (#77)
Browse files Browse the repository at this point in the history
Currently the rancher setup step doesn't know to replace the rancher
plist file when it changes. This means `ih-setup upgrade` doesn't know
it needs to re-run rancher setup.

This PR adds the check for whether the plist file is out of sync to the
`test` function in rancher setup.
  • Loading branch information
pb-dod authored Jan 10, 2024
1 parent f914679 commit 630df6f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.39
0.1.40
2 changes: 1 addition & 1 deletion formula/ih-core.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class IhCore < Formula
VERSION="0.1.39"
VERSION="0.1.40"
desc "Brew formula for installing core tools used at Included Health engineering."
homepage "https://github.com/ConsultingMD/homebrew-ih-public"
license "CC BY-NC-ND 4.0"
Expand Down
13 changes: 10 additions & 3 deletions lib/core/rancher/step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function ih::setup::core.rancher::help() {
RANCHER_AUGMENT_SRC="$IH_CORE_LIB_DIR/core/rancher/default/11_rancher.sh"
RANCHER_AUGMENT_DST="$IH_DEFAULT_DIR/11_rancher.sh"

PLIST_SRC="$IH_CORE_LIB_DIR/core/rancher/io.rancherdesktop.profile.defaults.plist"
PLIST_DST="$HOME/Library/Preferences/io.rancherdesktop.profile.defaults.plist"

# Check if the step has been installed and return 0 if it has.
# Otherwise return 1.
function ih::setup::core.rancher::test() {
Expand Down Expand Up @@ -36,9 +39,13 @@ function ih::setup::core.rancher::test() {
return 1
fi

# Check for PLIST FILE
PLISTFILE="$HOME/Library/Preferences/io.rancherdesktop.profile.defaults.plist"
if [ ! -f "$PLISTFILE" ]; then
if [ ! -f "$PLIST_DST" ]; then
ih::log::debug "The PLIST file is missing."
return 1
fi

if ! ih::file::check-file-in-sync "$PLIST_SRC" "$PLIST_DST"; then
ih::log::debug "The PLIST file is out of sync."
return 1
fi

Expand Down

0 comments on commit 630df6f

Please sign in to comment.