[icinga-checkins] icinga.org: icingaweb2/refs/tags/v2.2.2: RemoteCommandFile: Don' t close stdin to support transmitting multiple commands

git at icinga.org git at icinga.org
Thu Jun 9 16:46:08 CEST 2016


Module: icingaweb2
Branch: refs/tags/v2.2.2
Commit: 64e26687565b506dce60e613033193eec6711a55
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=64e26687565b506dce60e613033193eec6711a55

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Thu Jun  9 16:43:06 2016 +0200

RemoteCommandFile: Don't close stdin to support transmitting multiple commands

---

 .../Command/Transport/RemoteCommandFile.php        |   24 ++------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php b/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php
index ab0e78c..5426bb9 100644
--- a/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php
+++ b/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php
@@ -341,24 +341,6 @@ class RemoteCommandFile implements CommandTransportInterface
                     'Failed to write the whole command to the remote command pipe'
                 );
             }
-            fclose($this->sshPipes[0]);
-            $readBuffer = $read = array($this->sshPipes[2]);
-            $write = null;
-            $except = null;
-            $stderr = '';
-            while (
-                false !== (stream_select($readBuffer, $write, $exceptBuffer, 0, 20000))
-                && $this->getSshProcessStatus('running')
-            ) {
-                if (! empty($readBuffer)) {
-                    $stderr .= stream_get_contents($readBuffer[0]);
-                }
-                // Reset buffer
-                $readBuffer = $read;
-            }
-            if (! empty($stderr)) {
-                throw new CommandTransportException('Can\'t send external Icinga command: %s', trim($stderr));
-            }
         } else {
             $this->throwSshFailure();
         }
@@ -436,7 +418,7 @@ class RemoteCommandFile implements CommandTransportInterface
 
         if (! is_resource($this->sshProcess)) {
             throw new CommandTransportException(
-                'Can\'t send external Icinga command, failed to fork SSH'
+                'Can\'t send external Icinga command: Failed to fork SSH'
             );
         }
     }
@@ -473,9 +455,7 @@ class RemoteCommandFile implements CommandTransportInterface
     public function __destruct()
     {
         if (is_resource($this->sshProcess)) {
-            if (is_resource($this->sshPipes[0])) {
-                fclose($this->sshPipes[0]);
-            }
+            fclose($this->sshPipes[0]);
             fclose($this->sshPipes[1]);
             fclose($this->sshPipes[2]);
 



More information about the icinga-checkins mailing list