From 823cf84852662357ec275991046bff63822c3c8a Mon Sep 17 00:00:00 2001
From: chausman <chausman@nrao.edu>
Date: Fri, 16 Jul 2021 15:26:23 -0600
Subject: [PATCH] fixing Standard CMS Imaging

---
 .../pexable/casa_envoy/casa_envoy/auditor.py           | 10 +++++-----
 .../pexable/casa_envoy/casa_envoy/launchers.py         |  8 ++++----
 .../pexable/casa_envoy/test/test_auditor.py            |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/apps/cli/executables/pexable/casa_envoy/casa_envoy/auditor.py b/apps/cli/executables/pexable/casa_envoy/casa_envoy/auditor.py
index 85feb6899..f182017ba 100644
--- a/apps/cli/executables/pexable/casa_envoy/casa_envoy/auditor.py
+++ b/apps/cli/executables/pexable/casa_envoy/casa_envoy/auditor.py
@@ -30,8 +30,8 @@ def get_fields_for(product_type: str, filename: str) -> list:
         "creationTime",
         "productLocator",
         "destinationDirectory",
-        "cms_path",
-        "sdmId",
+        "calibrationSourceDirectory",
+        "cmsName",
     ]
 
     restore_metadata_list = [
@@ -85,7 +85,7 @@ class AuditFiles(AuditorIF):
 
         if ".json" in file.filename:
             for tag in fields:
-                if tag not in content or len(json.loads(content)[tag]) == 0:
+                if tag not in content:
                     missing.append(tag)
         if len(missing) > 0:
             print(f"Missing fields: {missing}")
@@ -123,7 +123,7 @@ class AuditFiles(AuditorIF):
                 invalid_files.append(file.filename)
 
         if len(invalid_files) != 0:
-            self.logger.info(f"INVALID FILE FOUND: {invalid_files}")
+            self.logger.error(f"INVALID FILE FOUND: {invalid_files}")
             return False
         else:
             return True
@@ -142,7 +142,7 @@ class AuditDirectories(AuditorIF):
         current = os.getcwd()
         needed = self.rootDirectory + "/" + self.relative_path
         if needed != current:
-            self.logger.info("DIRECTORY ERROR: not in correct directory for processing.")
+            self.logger.error("DIRECTORY ERROR: not in correct directory for processing.")
             return False
         else:
             working = Path(current + "/working").is_dir()
diff --git a/apps/cli/executables/pexable/casa_envoy/casa_envoy/launchers.py b/apps/cli/executables/pexable/casa_envoy/casa_envoy/launchers.py
index a98f38f38..bd33001c2 100644
--- a/apps/cli/executables/pexable/casa_envoy/casa_envoy/launchers.py
+++ b/apps/cli/executables/pexable/casa_envoy/casa_envoy/launchers.py
@@ -50,7 +50,7 @@ class CasaLauncher:
             self.logger.info(f"{var}: {env}")
 
         if "None" in result_list:
-            self.logger.info("Environment setup Failed!")
+            self.logger.error("Environment setup Failed!")
             sys.exit(1)
         else:
             self.logger.info("Environment ready for processing")
@@ -189,7 +189,7 @@ class ImagingLauncher(LauncherIF):
         if cms_name is not None and cms_path is not None and cms_name[-3:] == ".ms":
             return True
         else:
-            self.logger.info("CMS ERROR: Imaging requires a valid CMS name and location!")
+            self.logger.error("CMS ERROR: Imaging requires a valid CMS name and location!")
             return False
 
     def check_cal_and_imageable(self) -> bool:
@@ -219,12 +219,12 @@ class ImagingLauncher(LauncherIF):
         if dir_audit:
             self.logger.info("Directory audit successful!")
         else:
-            self.logger.info("FAILURE: directory structure audit was unsuccessful!")
+            self.logger.error("FAILURE: directory structure audit was unsuccessful!")
             sys.exit(1)
 
         audit = AuditFiles([self.ppr, self.metadata], parameters).audit()
         if audit:
             self.logger.info("File audit successful!")
         else:
-            self.logger.info("FAILURE: file audit was unsuccessful!")
+            self.logger.error("FAILURE: file audit was unsuccessful!")
             sys.exit(1)
diff --git a/apps/cli/executables/pexable/casa_envoy/test/test_auditor.py b/apps/cli/executables/pexable/casa_envoy/test/test_auditor.py
index f5ed148b1..c55e1682f 100644
--- a/apps/cli/executables/pexable/casa_envoy/test/test_auditor.py
+++ b/apps/cli/executables/pexable/casa_envoy/test/test_auditor.py
@@ -72,8 +72,8 @@ def test_get_fields_for():
         "creationTime",
         "productLocator",
         "destinationDirectory",
-        "cms_path",
-        "sdmId",
+        "calibrationSourceDirectory",
+        "cmsName",
     ]
     result = get_fields_for(product_type=product_type2, filename=test_img_metadata.filename)
     assert result == img_fields
-- 
GitLab