Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Only execute setup-apt-repo if necessary.

Alex Vandiverd15e6990e524
diff --git a/puppet/zulip/manifests/apt_repository.pp b/puppet/zulip/manifests/apt_repository.pp
index a6444f6e79e..ad64914d725 100644
--- a/puppet/zulip/manifests/apt_repository.pp
+++ b/puppet/zulip/manifests/apt_repository.pp
@@ -2,5 +2,6 @@ class zulip::apt_repository {
$setup_apt_repo_file = "${::zulip_scripts_path}/lib/setup-apt-repo"
exec{'setup_apt_repo':
command => "bash -c '${setup_apt_repo_file}'",
+ unless => "bash -c '${setup_apt_repo_file} --verify'",
}
}
diff --git a/scripts/lib/setup-apt-repo b/scripts/lib/setup-apt-repo
index f3dfb97b69a..3d5c762194c 100755
--- a/scripts/lib/setup-apt-repo
+++ b/scripts/lib/setup-apt-repo
@@ -4,6 +4,22 @@ set -e
set -u
set -o pipefail
+verify=false
+args="$(getopt -o '' --long verify -- "$@")"
+eval "set -- $args"
+while true; do
+ case "$1" in
+ --verify)
+ verify=true
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ esac
+done
+
# Ensure the directory for LAST_DEPENDENCIES_HASH exists
mkdir -p /var/lib/zulip
@@ -21,6 +37,8 @@ LAST_DEPENDENCIES_HASH="$(cat "$DEPENDENCIES_HASH_FILE")"
# (apt keys, code, etc.) changed.
if [ "$DEPENDENCIES_HASH" = "$LAST_DEPENDENCIES_HASH" ]; then
exit 0
+elif [ "$verify" == true ]; then
+ exit 1
fi
# Ensure that the sources file exists