From b2d9400ceb96332de1ccbcaae73d0e2cace8568c Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Tue, 21 Nov 2023 15:00:11 +0100
Subject: [PATCH] fix rollout plugins

---
 public_html/deployment/classes/rollout_base.class.php | 11 ++++++-----
 .../deployment/plugins/rollout/awx/rollout_awx.php    |  9 +++++----
 .../plugins/rollout/default/rollout_default.php       |  5 +++--
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/public_html/deployment/classes/rollout_base.class.php b/public_html/deployment/classes/rollout_base.class.php
index 8d804d55..4d0956c4 100644
--- a/public_html/deployment/classes/rollout_base.class.php
+++ b/public_html/deployment/classes/rollout_base.class.php
@@ -451,9 +451,9 @@ class rollout_base implements iRolloutplugin{
     // ----------------------------------------------------------------------
 
     /**
-     * get a hash with the merged config for project or mo specific: of a given 
-     * phase
-     * @param  string  $sPhase
+     * get configuration for the project .. or more specifi for a given phase
+     * @param  string   $sPhase
+     * @param  boolean  $bMask   Flag for public output; if true then mask your secrets
      * @return array
      */
     public function getConfig($sPhase=false, $bMask=false){
@@ -476,10 +476,11 @@ class rollout_base implements iRolloutplugin{
     
     /**
      * get an array with shell commands to execute
-     * @param  string  $sPhase
+     * @param  string   $sPhase
+     * @param  boolean  $bMask   Flag for public output; if true then mask your secrets
      * @return array
      */
-    public function getDeployCommands($sPhase){
+    public function getDeployCommands($sPhase, $bMask=false){
         return [
             'echo "ERROR: The method getDeployCommamds($sPhase) was not implemented in the rollout plugin ['.$this->getId().']"',
             'exit 1'
diff --git a/public_html/deployment/plugins/rollout/awx/rollout_awx.php b/public_html/deployment/plugins/rollout/awx/rollout_awx.php
index 6c6df0d6..5bb67135 100644
--- a/public_html/deployment/plugins/rollout/awx/rollout_awx.php
+++ b/public_html/deployment/plugins/rollout/awx/rollout_awx.php
@@ -167,12 +167,13 @@ class rollout_awx extends rollout_base {
     /**
      * get array with commands to execute to deploy a package
      * 
-     * @param string  $sPhase  phase
+     * @param  string   $sPhase
+     * @param  boolean  $bMask   Flag for public output; if true then mask your secrets
      * @return array
      */
-    public function getDeployCommands($sPhase){
+    public function getDeployCommands($sPhase, $bMask=false){
         $aReturn=array();
-        $aConfig=$this->getConfig($sPhase);
+        $aConfig=$this->getConfig($sPhase, $bMask);
         
         // ----- Checks:
         $sCmdChecks='';
@@ -185,7 +186,7 @@ class rollout_awx extends rollout_base {
         }
         
         if(!isset($aConfig['inventory']) || !(int)$aConfig['inventory']){
-            $sCmdChecks.='echo "ERROR: no inventory was given."; exit 1; ';
+            $sCmdChecks.='echo "ERROR: no awx inventory was given."; exit 1; ';
         }
         
         // ----- Send variables having values only
diff --git a/public_html/deployment/plugins/rollout/default/rollout_default.php b/public_html/deployment/plugins/rollout/default/rollout_default.php
index cc494176..dcb10bce 100644
--- a/public_html/deployment/plugins/rollout/default/rollout_default.php
+++ b/public_html/deployment/plugins/rollout/default/rollout_default.php
@@ -28,10 +28,11 @@ class rollout_default extends rollout_base {
     /**
      * get array with commands to execute to deploy a package
      * 
-     * @param string  $sPhase  phase
+     * @param  string   $sPhase
+     * @param  boolean  $bMask   Flag for public output; if true then mask your secrets
      * @return array
      */
-    public function getDeployCommands($sPhase){
+    public function getDeployCommands($sPhase, $bMask=false){
         return [
             'echo "SKIP"'
         ];
-- 
GitLab