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

ci - add page checkssh

parent afcec6a7
No related branches found
No related tags found
No related merge requests found
...@@ -12,12 +12,18 @@ ...@@ -12,12 +12,18 @@
$sOK='<span class="ok">' . t('ok') . '</span>'; $sOK='<span class="ok">' . t('ok') . '</span>';
$sFAILED='<span class="error">' . t('error') . '</span>'; $sFAILED='<span class="error">' . t('error') . '</span>';
$aErrors=array();
global $sOK; global $sOK;
global $sFAILED; global $sFAILED;
global $aErrors;
// test only // test only
// $aConfig['mirrorPackages']=array('puppet' => array('target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment'),); // $aConfig['mirrorPackages']=array('puppet' => array('target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment'),);
// ----------------------------------------------------------------------
// functions
// ----------------------------------------------------------------------
/** /**
* exec a command and show OK or FAILED * exec a command and show OK or FAILED
* *
...@@ -27,17 +33,22 @@ global $sFAILED; ...@@ -27,17 +33,22 @@ global $sFAILED;
* @return string * @return string
*/ */
function myExec($sCmd){ function myExec($sCmd){
global $sOK, $sFAILED; global $sOK, $sFAILED, $aErrors;
$sReturn=''; $sReturn='';
exec($sCmd . " 2>&1 && echo '$sOK' || echo '$sFAILED' ", $aOut); exec($sCmd . " 2>&1 && echo '$sOK' || echo '$sFAILED' ", $aOut);
$sReturn .= "<pre><strong>\$ $sCmd</strong><br>" $sReturn .= "<pre><strong>\$ $sCmd</strong><br>"
. implode('<br>', $aOut)."<br>" . implode('<br>', $aOut)."<br>"
. "</pre>"; . "</pre>";
if (strpos($sReturn, $sFAILED)){
$aErrors[]=$sCmd;
}
return $sReturn; return $sReturn;
} }
// ----------------------------------------------------------------------
// main
// ----------------------------------------------------------------------
$sOut = '<h2>SSH</h2>'; $sOut = '<h2>SSH</h2>';
...@@ -62,9 +73,13 @@ foreach ($oPrj1->getProjects() as $sPrj) { ...@@ -62,9 +73,13 @@ foreach ($oPrj1->getProjects() as $sPrj) {
. '<ul>'; . '<ul>';
// test repository // test repository
$sOut .= '<li>'.t('repositoryinfos').' <strong>' . $aPrjConfig['build']['url'] . '</strong> - ' $sOut .= '<li>'.t('repositoryinfos').' <strong>' . $aPrjConfig['build']['url'] . '</strong> - ';
. ($oPrj->getRepoRevision() ? $sOK : $sFAILED) if($oPrj->getRepoRevision()){
; $sOut .= $sOK;
} else {
$sOut .= $sFAILED;
$aErrors[] = $aPrjConfig['build']['url'];
}
// loop over phases ... // loop over phases ...
foreach (array_keys($oPrj->getPhases()) as $sPhase) { foreach (array_keys($oPrj->getPhases()) as $sPhase) {
...@@ -80,4 +95,8 @@ foreach ($oPrj1->getProjects() as $sPrj) { ...@@ -80,4 +95,8 @@ foreach ($oPrj1->getProjects() as $sPrj) {
} }
$sOut.='</ul>'; $sOut.='</ul>';
} }
if(count($aErrors)){
echo $oHtml->getBox('error', '<ol><li>'.implode('<li>', $aErrors), '</ol>');
}
echo $sOut; echo $sOut;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment