Skip to content

Commit

Permalink
pre-install-payload: Expand the ifs ...
Browse files Browse the repository at this point in the history
Instead of doing `[ ... ] && ...`, let's just expand the if as we could
simply fail the first condition, making the whole script fail, leading
then to a pod error.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Aug 24, 2023
1 parent bc254ba commit 539f465
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ function uninstall_artifacts() {
echo "Removing the systemd drop-in file"
rm -f /etc/systemd/system/${container_engine}.service.d/${container_engine}-for-cc-override.conf
echo "Removing the systemd drop-in file's directory, if empty"
[ -d /etc/systemd/system/${container_engine}.service.d ] && rmdir --ignore-fail-on-non-empty /etc/systemd/system/${container_engine}.service.d
if [ -d /etc/systemd/system/${container_engine}.service.d ]; then
rmdir --ignore-fail-on-non-empty /etc/systemd/system/${container_engine}.service.d
fi

restart_systemd_service

echo "Removing the containerd binary"
rm -f /opt/confidential-containers/bin/containerd
echo "Removing the /opt/confidential-containers/bin directory"
[ -d /opt/confidential-containers/bin ] && rmdir --ignore-fail-on-non-empty -p /opt/confidential-containers/bin
if [ -d /opt/confidential-containers/bin ]; then
rmdir --ignore-fail-on-non-empty -p /opt/confidential-containers/bin
fi
}

function restart_systemd_service() {
Expand Down

0 comments on commit 539f465

Please sign in to comment.