From: Jochen Topf Date: Mon, 7 Mar 2022 15:05:45 +0000 (+0100) Subject: Do not create temporary planet file when update was not complete X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/5a720fa766c5fb9ac9886e8551a961eb8764428c Do not create temporary planet file when update was not complete When the update of the planet file was not complete (when pyosmium-up-to-date returns 1), the resulting planet is nevertheless usable, so we can keep it instead of creating a temporary one. This way we use less disk space because there is one fewer copy of the planet around. --- diff --git a/cookbooks/planet/templates/default/planet-update-file.erb b/cookbooks/planet/templates/default/planet-update-file.erb index 16c7fed17..73a778bba 100644 --- a/cookbooks/planet/templates/default/planet-update-file.erb +++ b/cookbooks/planet/templates/default/planet-update-file.erb @@ -10,16 +10,15 @@ PLANETDIR="/var/lib/planet" PLANETPREV="${PLANETDIR}/planet-previous.${SUFFIX}" PLANETCURR="${PLANETDIR}/planet.${SUFFIX}" PLANETNEW="${PLANETDIR}/planet-new.${SUFFIX}" -PLANETTMP="${PLANETDIR}/planet-tmp.${SUFFIX}" pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" retval=$? while [ $retval -eq 1 ]; do - mv "$PLANETNEW" "$PLANETTMP" - pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETTMP" + mv "$PLANETCURR" "$PLANETPREV" + mv "$PLANETNEW" "$PLANETCURR" + pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" retval=$? - rm "$PLANETTMP" done if [ $retval -ne 0 ]; then