فهرست منبع

HPCC-15298 Fix regression caused by rmtssh and environment changes

Signed-off-by: Michael Gardner <Michael.Gardner@lexisnexis.com>
Michael Gardner 9 سال پیش
والد
کامیت
82ee3eab94
4فایلهای تغییر یافته به همراه24 افزوده شده و 1 حذف شده
  1. 10 0
      common/remote/rmtssh.cpp
  2. 2 0
      common/remote/rmtssh.hpp
  3. 11 0
      esp/services/ws_machine/ws_machineService.cpp
  4. 1 1
      initfiles/etc/DIR_NAME/environment.xml.in

+ 10 - 0
common/remote/rmtssh.cpp

@@ -565,6 +565,16 @@ public:
         workdir.set(workdirname);
         workdir.set(workdirname);
         exec();
         exec();
     }
     }
+
+    const StringArray &getReplyText() const
+    {
+      return replytext;
+    }
+
+    const UnsignedArray &getReply() const
+    {
+      return reply;
+    }
 };
 };
 
 
 IFRunSSH *createFRunSSH()
 IFRunSSH *createFRunSSH()

+ 2 - 0
common/remote/rmtssh.hpp

@@ -44,6 +44,8 @@ interface IFRunSSH: extends IInterface
               const IpAddress &ip,
               const IpAddress &ip,
               const char *workdirname,
               const char *workdirname,
               bool _background) = 0;
               bool _background) = 0;
+    virtual const StringArray &getReplyText() const = 0;
+    virtual const UnsignedArray &getReply() const= 0;
 };
 };
 
 
 
 

+ 11 - 0
esp/services/ws_machine/ws_machineService.cpp

@@ -1187,7 +1187,18 @@ int Cws_machineEx::runCommand(IEspContext& context, const char* sAddress, const
 
 
         IFRunSSH * connection = createFRunSSH();
         IFRunSSH * connection = createFRunSSH();
         connection->init(command.str(),NULL,NULL,NULL,m_SSHConnectTimeoutSeconds,0);
         connection->init(command.str(),NULL,NULL,NULL,m_SSHConnectTimeoutSeconds,0);
+        // executed as single connection
         connection->exec(sAddress,NULL,true);
         connection->exec(sAddress,NULL,true);
+        response.append(connection->getReplyText()[0]);
+        exitCode = connection->getReply()[0];
+        int len = response.length();
+        if (len > 0 && response.charAt(--len) == '\n') // strip newline
+          response.setLength(len);
+        if (response.length() && !exitCode)
+          response.insert(0, "Response: ");
+        else if (!exitCode)
+          response.insert(0, "No response recieved.\n");
+
     }
     }
     // CFRunSSH uses a MakeStringExceptionDirect throw to pass code and result string
     // CFRunSSH uses a MakeStringExceptionDirect throw to pass code and result string
     catch(IException* e)
     catch(IException* e)

+ 1 - 1
initfiles/etc/DIR_NAME/environment.xml.in

@@ -761,7 +761,7 @@
   </EclSchedulerProcess>
   </EclSchedulerProcess>
  </Software>
  </Software>
  <EnvSettings>
  <EnvSettings>
-  <pid>${PID_DIR}</pid>
+  <pid>${PID_PATH}</pid>
   <sourcedir>${CONFIG_SOURCE_PATH}</sourcedir>
   <sourcedir>${CONFIG_SOURCE_PATH}</sourcedir>
   <mpTraceLevel>0</mpTraceLevel>
   <mpTraceLevel>0</mpTraceLevel>
   <mpStart>7101</mpStart>
   <mpStart>7101</mpStart>