]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
cloud: Fix #10291 clean_cloud_volume uses "ls", so we handle its return code the...
authornorbert.bizet <norbert.bizet@baculasystems.com>
Thu, 21 Dec 2023 14:57:16 +0000 (09:57 -0500)
committerEric Bollengier <eric@baculasystems.com>
Thu, 21 Mar 2024 16:32:30 +0000 (17:32 +0100)
bacula/src/stored/generic_driver.c

index e8bd9b488b07509a1a77c2e2367e2193a42966d2..e5bea443269e40ade070d41305d9d7d6ad63b003 100644 (file)
@@ -1123,6 +1123,16 @@ bool generic_driver::clean_cloud_volume(const char *VolumeName, cleanup_cb_type
    /* list everything in the volume VolumeName */
    int ret = call_fct("ls", VolumeName, "", &pcb, NULL, cancel_cb, err);
    free_pool_memory(*arg.remain);
+   /* 1 is the generic return code for path not found, except for was driver that always return 0 */
+   if (ret == 1) {
+      err = strip_trailing_junk(err);
+      pm_strcat(err, " Cloud volume ");
+      pm_strcat(err, VolumeName);
+      pm_strcat(err, " not found.\n");
+      /* the volume could not be found in the cloud: it's possible to list a Volume on cloud that doesn't exist. 
+         Accept it as an OK behavior */
+      return true;
+   }
 
    int rtn=0;
    char *part = NULL;