From d2a687e926837b4dc4e5420b3d15ceca78319b1f Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Fri, 26 Jan 2018 11:44:11 +0100
Subject: [PATCH] ci server - config - detect prod system by directory

---
 hooks/templates/inc_projects_config.php.erb | 34 ++++++++++++---------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/hooks/templates/inc_projects_config.php.erb b/hooks/templates/inc_projects_config.php.erb
index e18e745b..0db51c41 100644
--- a/hooks/templates/inc_projects_config.php.erb
+++ b/hooks/templates/inc_projects_config.php.erb
@@ -4,7 +4,7 @@
 // fetch status infos von den einzelnen Phasen
 // ----------------------------------------------------------------------
 
-    $aConfig = array(
+$aConfig = array(
     // Basispfad:
     'workDir' => '/var/imldeployment',
     'tmpDir' => '/var/tmp/imldeployment',
@@ -101,6 +101,10 @@
 // override for local development
 // ----------------------------------------------------------------------
 
+// unsafe ... 
+// make a check that fits your environemnt
+// php_uname("n") can send a short hostname (without domain)
+$bProd=!!strpos(__DIR__, '/ci.iml.unibe.ch/');
 
 switch (php_uname("n")) {
     case "USER":
@@ -112,19 +116,21 @@ switch (php_uname("n")) {
     case "ci.iml.unibe.ch":
     case "ci":
 
-        // synch der Pakete nur auf dem Livesystem
-        $aConfig['mirrorPackages'] = array(
-            'puppet' => array(
-                'type' => 'rsync',
-                'runas' => 'www-data', // nur fuer commandline
-                'target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment',
-            ),
-            'puppet.one' => array(
-                'type' => 'rsync',
-                'runas' => 'www-data', // nur fuer commandline
-                'target' => 'copy-deployment@puppet.one.iml.unibe.ch:/var/shared/imldeployment',
-            ),
-        );
+        if ($bProd){
+            // synch der Pakete nur auf dem Livesystem
+            $aConfig['mirrorPackages'] = array(
+                'puppet' => array(
+                    'type' => 'rsync',
+                    'runas' => 'www-data', // nur fuer commandline
+                    'target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment',
+                ),
+                'puppet.one' => array(
+                    'type' => 'rsync',
+                    'runas' => 'www-data', // nur fuer commandline
+                    'target' => 'copy-deployment@puppet.one.iml.unibe.ch:/var/shared/imldeployment',
+                ),
+            );
+        }
         break;
 
     default:
-- 
GitLab