瀏覽代碼

Merge pull request #9018 from Michael-Gardner/HPCC-16103

HPCC-16103 Removed logging from common/remote/rmtssh.cpp

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 年之前
父節點
當前提交
50b607ecef
共有 2 個文件被更改,包括 15 次插入25 次删除
  1. 4 25
      common/remote/rmtssh.cpp
  2. 11 0
      services/runagent/frunssh.cpp

+ 4 - 25
common/remote/rmtssh.cpp

@@ -340,13 +340,6 @@ public:
  
     void exec(unsigned i,unsigned treefrom)
     {
-        {
-            CriticalBlock block1(sect);
-            if (!dryrun) {
-                if (slaves.ordinality()>1)
-                    PROGLOG("%d: starting %s (%d of %d finished)",i,slaves.item(i),done.ordinality(),slaves.ordinality());
-            }
-        }
         int retcode=-1;
         StringBuffer outbuf;
         try {
@@ -447,7 +440,7 @@ public:
                             firsterr = false;
                             if (outbuf.length())
                                 outbuf.append('\n');
-                            outbuf.append("ERR: ");
+                            outbuf.append("STDERR: ");
                         }
                         outbuf.append(read,(const char *)buf);
                     }
@@ -512,7 +505,6 @@ public:
         if (dryrun)
             return;
         if (slaves.ordinality()>1) {
-            PROGLOG("Results: (%d of %d finished)",done.ordinality(),slaves.ordinality());
             int errCode = 0;
             Owned<IMultiException> multiException = MakeMultiException();
             for (unsigned i=0;i<done.ordinality();i++) {
@@ -520,21 +512,9 @@ public:
                 StringBuffer res(replytext.item(n));
                 while (res.length()&&(res.charAt(res.length()-1)<=' '))
                     res.setLength(res.length()-1);
-                if (res.length()==0 && !reply.item(n))
-                    PROGLOG("%d: %s(%d): [OK]",n+1,slaves.item(n),reply.item(n));
-                else if (strchr(res.str(),'\n')==NULL) {
-                    PROGLOG("%d: %s(%d): %s",n+1,slaves.item(n),reply.item(n),res.str());
-                    if (reply.item(n)) {
-                        errCode = reply.item(n);
-                        multiException->append(*MakeStringExceptionDirect(reply.item(n),res.str()));
-                    }
-                }
-                else {
-                    PROGLOG("%d: %s(%d):\n---------------------------\n%s\n===========================",n+1,slaves.item(n),reply.item(n),res.str());
-                    if (reply.item(n)) {
-                        errCode = reply.item(n);
-                        multiException->append(*MakeStringExceptionDirect(reply.item(n),res.str()));
-                    }
+                if (reply.item(n)) {
+                    errCode = reply.item(n);
+                    multiException->append(*MakeStringExceptionDirect(errCode,res.str()));
                 }
             }
             if (errCode)
@@ -544,7 +524,6 @@ public:
             StringBuffer res(replytext.item(0));
             while (res.length()&&(res.charAt(res.length()-1)<=' '))
                 res.setLength(res.length()-1);
-            PROGLOG("%s result(%d):\n%s",useplink?"plink":"ssh",reply.item(0),res.str());
             if (reply.item(0))
                 throw MakeStringExceptionDirect(reply.item(0), res.str());
         }

+ 11 - 0
services/runagent/frunssh.cpp

@@ -67,6 +67,17 @@ int main( int argc, char *argv[] )
         Owned<IFRunSSH> runssh = createFRunSSH();
         runssh->init(argc,argv);
         runssh->exec();
+        const StringArray & strArray = runssh->getReplyText();
+        const UnsignedArray & unsArray = runssh->getReply();
+        for(unsigned i = 0;i < unsArray.ordinality();i++) {
+            StringBuffer buf = strArray.item(i);
+            // strip newlines off end of string buf
+            if (buf.length() && (buf.charAt(buf.length()-1)) == '\n') {
+                buf.setLength(buf.length()-1);
+                buf.clip();
+            }
+            PROGLOG("%d: ssh(%d): %s",i+1,unsArray.item(i),buf.str());
+        }
     }
     catch(IException *e)
     {