Skip to content
Snippets Groups Projects
Commit 8a56ef2f authored by hahn's avatar hahn
Browse files

fix warning in rollout_awx plugin

parent 42c7b940
Branches
No related tags found
1 merge request!385591 remove warnings
...@@ -176,7 +176,7 @@ class rollout_awx extends rollout_base { ...@@ -176,7 +176,7 @@ class rollout_awx extends rollout_base {
// ----- Checks: // ----- Checks:
$sCmdChecks=''; $sCmdChecks='';
if($aConfig['extravars']){ if(isset($aConfig['extravars']) && $aConfig['extravars']){
$aTmp=json_decode($aConfig['extravars'], 1); $aTmp=json_decode($aConfig['extravars'], 1);
if (!$aTmp || !is_array($aTmp) || !count($aTmp) ){ if (!$aTmp || !is_array($aTmp) || !count($aTmp) ){
$sCmdChecks.='echo "ERROR: Value in extravars has wrong Syntax - this is no JSON: '.$aConfig['extravars'].'"; exit 1; '; $sCmdChecks.='echo "ERROR: Value in extravars has wrong Syntax - this is no JSON: '.$aConfig['extravars'].'"; exit 1; ';
...@@ -184,14 +184,14 @@ class rollout_awx extends rollout_base { ...@@ -184,14 +184,14 @@ class rollout_awx extends rollout_base {
$aConfig['extravars']=json_encode($aTmp); $aConfig['extravars']=json_encode($aTmp);
} }
if(!(int)$aConfig['inventory']){ if(!isset($aConfig['inventory']) || !(int)$aConfig['inventory']){
$sCmdChecks.='echo "ERROR: no inventory was given."; exit 1; '; $sCmdChecks.='echo "ERROR: no inventory was given."; exit 1; ';
} }
// ----- Send variables having values only // ----- Send variables having values only
$aBodyvars=array(); $aBodyvars=array();
foreach(['inventory'=>'inventory', 'limit'=>'limit', 'job_tags'=>'tags', 'extra_vars'=>'extravars'] as $sParam=>$sVarkey){ foreach(['inventory'=>'inventory', 'limit'=>'limit', 'job_tags'=>'tags', 'extra_vars'=>'extravars'] as $sParam=>$sVarkey){
if ($aConfig[$sVarkey]) { if (isset($aConfig[$sVarkey]) && $aConfig[$sVarkey]) {
$aBodyvars[$sParam]=$aConfig[$sVarkey]; $aBodyvars[$sParam]=$aConfig[$sVarkey];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment