From 0fb11c517e680df5687ec8ecf59a79907dc08c8c Mon Sep 17 00:00:00 2001
From: Nathan Bockisch <nbockisc@nrao.edu>
Date: Thu, 14 Sep 2023 07:29:14 -0600
Subject: [PATCH] Modified gmva_ingester to copy directories from the GMVA
 source area to the difx directory so they can be picked up by stackstorm

---
 apps/cli/executables/go/gmva_ingester/README.md     |  4 ++--
 apps/cli/executables/go/gmva_ingester/main.go       |  2 +-
 .../go/gmva_ingester/pkg/copy/copy_gmva.go          | 13 +++++++------
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/apps/cli/executables/go/gmva_ingester/README.md b/apps/cli/executables/go/gmva_ingester/README.md
index 55c288560..b14b9b730 100644
--- a/apps/cli/executables/go/gmva_ingester/README.md
+++ b/apps/cli/executables/go/gmva_ingester/README.md
@@ -1,7 +1,7 @@
 # gmva_ingester
 
 `gmva_ingester` is a utility that copies GMVA observation directories from the
-GMVA source directory (defined in CAPO) to the VLBI ingestion staging directory
+GMVA source directory (defined in CAPO) to the difx directory
 (also defined in CAPO). It is not meant to be run by hand, but by a workflow
 that facilitates the entire GMVA observation ingestion process.
 
@@ -9,5 +9,5 @@ that facilitates the entire GMVA observation ingestion process.
 ```
 Usage of ./gmva_ingester:
   -dir string
-        Name of the GMVA directory within the GMVA source directory to be copied to the VLBI staging directory
+        Name of the GMVA directory within the GMVA source directory to be copied to the difx directory
 ```
diff --git a/apps/cli/executables/go/gmva_ingester/main.go b/apps/cli/executables/go/gmva_ingester/main.go
index ebd6a8717..90cb1cabb 100644
--- a/apps/cli/executables/go/gmva_ingester/main.go
+++ b/apps/cli/executables/go/gmva_ingester/main.go
@@ -28,7 +28,7 @@ import (
 func main()  {
     var gmvaDir string
 
-    flag.StringVar(&gmvaDir, "dir", "", "Name of the GMVA directory within the GMVA source directory to be copied to the VLBI staging directory")
+    flag.StringVar(&gmvaDir, "dir", "", "Name of the GMVA directory within the GMVA source directory to be copied to the difx directory")
     flag.Parse()
 
     if gmvaDir == "" {
diff --git a/apps/cli/executables/go/gmva_ingester/pkg/copy/copy_gmva.go b/apps/cli/executables/go/gmva_ingester/pkg/copy/copy_gmva.go
index 759cccfc7..f904f4a6b 100644
--- a/apps/cli/executables/go/gmva_ingester/pkg/copy/copy_gmva.go
+++ b/apps/cli/executables/go/gmva_ingester/pkg/copy/copy_gmva.go
@@ -50,9 +50,10 @@ func CopyGmva(dir string)  {
     capoProperties, err := config.InitConfig(os.Getenv("CAPO_PROFILE"), helpers.DefaultCapoPath)
     checkError(err)
 
-    ingestionSettings := capoProperties.SettingsForPrefix("edu.nrao.workspaces.IngestionSettings")
-    gmvaSourcePath := ingestionSettings.GetString("gmvaSourceDirectory")
-    vlbiStagingPath := ingestionSettings.GetString("vlbiStagingDirectory")
+    wsIngestionSettings := capoProperties.SettingsForPrefix("edu.nrao.workspaces.IngestionSettings")
+    gmvaSourcePath := wsIngestionSettings.GetString("gmvaSourceDirectory")
+    aatIngestionSettings := capoProperties.SettingsForPrefix("archive-ingestion")
+    difxPath := aatIngestionSettings.GetString("VLBAPath")
 
     // GMVA source only copies files starting with GMVA
     gmvaSourceFiles := strings.Join([]string{gmvaSourcePath, dir, "GMVA*"}, "/")
@@ -60,15 +61,15 @@ func CopyGmva(dir string)  {
     gmvaSourcePaths, err = filepath.Glob(gmvaSourceFiles)
     checkError(err)
 
-    vlbiTargetDir := strings.Join([]string{vlbiStagingPath, dir}, "/")
+    difxDir := strings.Join([]string{difxPath, dir}, "/")
 
     // First make the directory to copy files to
-    mkdirCmd := exec.Command("mkdir", vlbiTargetDir)
+    mkdirCmd := exec.Command("mkdir", difxDir)
     err = mkdirCmd.Run()
     checkError(err)
 
     for _, path := range gmvaSourcePaths {
-        copyCmd := exec.Command("cp", "-LR", path, vlbiTargetDir)
+        copyCmd := exec.Command("cp", "-LR", path, difxDir)
         err = copyCmd.Run()
         checkError(err)
     }
-- 
GitLab