Browse Source

sync: digest-ref probe tolerates absent image (inspect exit 1 = None, not ssh failure)

Alexander Korolev 3 weeks ago
parent
commit
3c1e2cd87c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/docker/sync.rs

+ 3 - 1
src/docker/sync.rs

@@ -9,9 +9,11 @@ use super::shq;
 async fn get_image_digest(config: &Config, node: &Node, image: &str) -> Result<Option<String>> {
 async fn get_image_digest(config: &Config, node: &Node, image: &str) -> Result<Option<String>> {
     // `docker image ls` does not accept digest refs (`repo@sha256:...`) —
     // `docker image ls` does not accept digest refs (`repo@sha256:...`) —
     // use `docker image inspect` for those; it also returns the image ID.
     // use `docker image inspect` for those; it also returns the image ID.
+    // `|| true`: inspect exits 1 when the ref is absent (a peer that simply
+    // doesn't have it yet) — that is "no digest", not an ssh failure.
     let cmd = if image.contains('@') {
     let cmd = if image.contains('@') {
         format!(
         format!(
-            "docker image inspect --format '{{{{.Id}}}}' {} 2>/dev/null",
+            "docker image inspect --format '{{{{.Id}}}}' {} 2>/dev/null || true",
             shq(image)
             shq(image)
         )
         )
     } else {
     } else {