From 2ed504a6ad5600192e19298b8c776692bca5d3af Mon Sep 17 00:00:00 2001
From: Alan De Smet <alan.desmet@ssec.wisc.edu>
Date: Wed, 1 Sep 2021 19:13:24 +0000
Subject: [PATCH] Fix log levels/messages for failed filesets

If all of the filesets are NOT expected, it's okay, just log at INFO.

If any fileset IS expected, that's worrying and generates a WARNING.
ERROR is too severe because we might be able to continue, and there is a
good chance that the error is entirely remote.
---
 csppfetch/__init__.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/csppfetch/__init__.py b/csppfetch/__init__.py
index 58ecc96..1c87531 100644
--- a/csppfetch/__init__.py
+++ b/csppfetch/__init__.py
@@ -840,7 +840,6 @@ class Downloader:
                 logprogress(f"Attempt {attempt}")
             for fileset in filesets:
                 description = fileset.description
-                expected = fileset.expected
                 urls_to_files = fileset.urls_to_files
                 logprogress(f"  Working on {description}")
                 logging.info(f"    files to get: {urls_to_files}")
@@ -871,8 +870,13 @@ class Downloader:
         if all_problems_are_missing_files(problems):
             raise DownloadsFailedException(f"No usable {self.name} file set is present locally and downloads are disabled")
 
-        logging.error("Unable to download any file set, reasons include:")
-        dump_problems(logging.error, problems)
+        any_file_is_expected = any([f.expected for f in filesets])
+        if any_file_is_expected:
+            logging.warning("Unable to download any file set, reasons include:")
+            dump_problems(logging.warning, problems)
+        else:
+            logging.info("It was expected that these file sets would not yet be available, and they aren't. Things we encountered while looking for them include:")
+            dump_problems(logging.info, problems)
 
         try:
             first = problems[0][0]
-- 
GitLab