From 32c903e1b14524b12336b90c72dde4a6c882604e Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Thu, 16 May 2019 14:24:53 +0200
Subject: [PATCH] ci server: fix ssh to pupet targets

---
 public_html/appmonitor/index.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/public_html/appmonitor/index.php b/public_html/appmonitor/index.php
index 93f84d1e..bf51c134 100644
--- a/public_html/appmonitor/index.php
+++ b/public_html/appmonitor/index.php
@@ -193,10 +193,12 @@ if(count($aConfig['mirrorPackages'])){
         (
             [type] => rsync
             [runas] => 
-            [target] => copy-deployment@puppet.one.iml.unibe.ch:/var/shared/imldeployment
+            [target] => copy-deployment@puppet:/var/shared/imldeployment
         )
          */
-        $sCmd='ssh '.$aData['target']. ' ls -1';
+        $sTargetHost = preg_replace('/\:.*/', '', $aData['target']);
+        $sCmd='ssh '.$sTargetHost. ' ls -1';
+
         exec($sCmd, $sOut, $iRc);
         $oMonitor->addCheck(
             array(
@@ -206,7 +208,7 @@ if(count($aConfig['mirrorPackages'])){
                     "function" => "Simple",
                     "params" => array(
                         "result" => $iRc ? RESULT_ERROR : RESULT_OK,
-                        "value" => "$sCmd returns $sOut",
+                        "value" => "Command [$sCmd] returns with exitcode $iRc; output: ".implode(" ", $sOut),
                     ),
                 ),
             )
-- 
GitLab