]> git.openstreetmap.org Git - chef.git/commitdiff
Do not create temporary planet file when update was not complete
authorJochen Topf <jochen@topf.org>
Mon, 7 Mar 2022 15:05:45 +0000 (16:05 +0100)
committerJochen Topf <jochen@topf.org>
Mon, 7 Mar 2022 15:05:45 +0000 (16:05 +0100)
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.

cookbooks/planet/templates/default/planet-update-file.erb

index 16c7fed17271bfa7ec59d3fa641e25f57f25e177..73a778bbaaa812c9bd33455683f0e05b0b41d3d7 100644 (file)
@@ -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