From e246b2652ca9164f190520b75f45cbe6cb506ebd Mon Sep 17 00:00:00 2001 From: Ryan Cragun Date: Fri, 2 Aug 2024 14:36:46 -0600 Subject: [PATCH] enos: support ancient systemd in `vault_upgrade` (#27960) Amazon Linux 2 uses an ancient version of Systemd/systemctl so instead of using -P when determining the unit file we use the less convenient -p. Signed-off-by: Ryan Cragun --- .../vault_upgrade/scripts/maybe-remove-old-unit-file.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/enos/modules/vault_upgrade/scripts/maybe-remove-old-unit-file.sh b/enos/modules/vault_upgrade/scripts/maybe-remove-old-unit-file.sh index cb56bdd3fa51..875923864027 100644 --- a/enos/modules/vault_upgrade/scripts/maybe-remove-old-unit-file.sh +++ b/enos/modules/vault_upgrade/scripts/maybe-remove-old-unit-file.sh @@ -18,7 +18,9 @@ fi # Get the unit file for the vault.service that is running. If it's not in /etc/systemd then it # should be a package provided unit file so we don't need to delete anything. -if ! unit_path=$(systemctl show -P FragmentPath vault 2>&1); then +# +# Note that we use -p instead of -P so that we support ancient amzn2 systemctl. +if ! unit_path=$(systemctl show -p FragmentPath vault | cut -d = -f2 2>&1); then echo "Skipped removing unit file because and existing path could not be found: $unit_path" exit 0 fi