From 7cab5cfec00e918f1e7670cdf1fa7e1db8434821 Mon Sep 17 00:00:00 2001 From: Alan Hanson Date: Wed, 30 Nov 2022 14:13:54 -0800 Subject: [PATCH] Make some uninstall failures not fatal (#1994) If the uninstall process can't find any omicron datasets, print a message and continue. It is possible they don't exist yet and the install steps later will create them if needed. Co-authored-by: Alan Hanson --- package/src/bin/omicron-package.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/package/src/bin/omicron-package.rs b/package/src/bin/omicron-package.rs index 587e8f5e2b..0283dfd16a 100644 --- a/package/src/bin/omicron-package.rs +++ b/package/src/bin/omicron-package.rs @@ -18,10 +18,10 @@ use omicron_zone_package::target::Target; use rayon::prelude::*; use ring::digest::{Context as DigestContext, Digest, SHA256}; use slog::debug; -use slog::info; use slog::o; use slog::Drain; use slog::Logger; +use slog::{info, warn}; use std::env; use std::fs::create_dir_all; use std::io::Write; @@ -454,7 +454,14 @@ fn get_all_omicron_datasets() -> Result> { } fn uninstall_all_omicron_datasets(config: &Config) -> Result<()> { - let datasets = get_all_omicron_datasets()?; + let datasets = match get_all_omicron_datasets() { + Err(e) => { + warn!(config.log, "Failed to get omicron datasets: {}", e); + return Ok(()); + } + Ok(datasets) => datasets, + }; + if datasets.is_empty() { return Ok(()); }