From 630df6f40952655765a8c833ebc4d5eb1f3b7cbb Mon Sep 17 00:00:00 2001 From: Paul Brown <67805647+pb-dod@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:04:30 -0600 Subject: [PATCH] Add test for rancher plist file sync (#77) 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. --- VERSION | 2 +- formula/ih-core.rb | 2 +- lib/core/rancher/step.sh | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 528bd04..7172442 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.39 +0.1.40 diff --git a/formula/ih-core.rb b/formula/ih-core.rb index fdcfbb2..bcce0d4 100644 --- a/formula/ih-core.rb +++ b/formula/ih-core.rb @@ -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" diff --git a/lib/core/rancher/step.sh b/lib/core/rancher/step.sh index 1eb7e97..5699079 100644 --- a/lib/core/rancher/step.sh +++ b/lib/core/rancher/step.sh @@ -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() { @@ -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