Browse Source

Merge pull request #13374 from richardkchapman/espserver-dlls

HPCC-23536 "Associated files" in workunit assume fixed IPs

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 5 years ago
parent
commit
cbe30556d0
1 changed files with 24 additions and 6 deletions
  1. 24 6
      common/workunit/workunit.cpp

+ 24 - 6
common/workunit/workunit.cpp

@@ -13526,12 +13526,30 @@ IPropertyTree * resolveDefinitionInArchive(IPropertyTree * archive, const char *
 
 extern WORKUNIT_API void associateLocalFile(IWUQuery * query, WUFileType type, const char * name, const char * description, unsigned crc, unsigned minActivity, unsigned maxActivity)
 {
-    StringBuffer hostname;
-    queryHostIP().getIpText(hostname);
-
-    StringBuffer fullPathname;
-    makeAbsolutePath(name, fullPathname);
-    query->addAssociatedFile(type, fullPathname, hostname, description, crc, minActivity, maxActivity);
+    StringBuffer fullPathName;
+    makeAbsolutePath(name, fullPathName);
+    if (isCloud())
+    {
+        const char *dllserver_root = getenv("HPCC_DLLSERVER_PATH");
+        assertex(dllserver_root != nullptr);
+        StringBuffer destPathName(dllserver_root);
+        addNonEmptyPathSepChar(destPathName);
+        splitFilename(fullPathName.str(), nullptr, nullptr, &destPathName, &destPathName);
+        OwnedIFile source = createIFile(fullPathName);
+        OwnedIFile target = createIFile(destPathName);
+        if (!target->exists())
+        {
+            source->copyTo(target, 0, NULL, true);
+        }
+        query->addAssociatedFile(type, destPathName, "localhost", description, crc, minActivity, maxActivity);
+        // Should we delete the local files? May not matter...
+    }
+    else
+    {
+        StringBuffer hostname;
+        queryHostIP().getIpText(hostname);
+        query->addAssociatedFile(type, fullPathName, hostname, description, crc, minActivity, maxActivity);
+    }
 }
 
 extern WORKUNIT_API void descheduleWorkunit(char const * wuid)