diff --git a/config/inc_roles.php b/config/inc_roles.php index 840866e30d1ddc963047c5a35476da4d541b9967..a29ef2d609fd97293a4e6b4bedeb38c0036a3b65 100644 --- a/config/inc_roles.php +++ b/config/inc_roles.php @@ -46,6 +46,7 @@ return array( "page_htmltest", "page_phase", "page_setup", + "page_checkssh", // see $oProject->renderLink() and $oProject->[äction] "project-action-default", diff --git a/config/lang/de.json b/config/lang/de.json index 5a8a4061155adf3488e684c949eec6aeb7c60f38..ba6137a10058035b5b898d744717cc0dea8512bf 100644 --- a/config/lang/de.json +++ b/config/lang/de.json @@ -152,7 +152,7 @@ "page-accept-error-cannot-accept-phase": "Die Phase [%s] kann nicht akzeptiert werden.", "page-accept-info": "Die Software wurde erfolgreich in der Phase <span class=\"%s\">%s</span> getestet und soll auf die nächste Phase <span class=\"%s\">%s</span> ausgerollt werden?", "page-accept-warning-version-exists-in-next-queue": "In der Queue von Phase [%s] ist die Version von [%s] bereits vorhanden!", - "page-accept-warning-version-exists-in-next-repo": "In der Phase [%s] ist die Version von [%s] bereits im Puppet-Repository vorhanden!", + "page-accept-warning-version-exists-in-next-repo": "In der Phase [%s] ist die dieselbe Version von [%s] bereits im Puppet vorhanden!", "page-accept-buttonlabel": "Die Phase [%s] akzeptieren und für Phase [%s] freigeben", "page-build-info": "Es wird ein neues Paket erstellt und für die Phase <em class=\"%s\">%s</em> bereitgestellt.", diff --git a/config/lang/en.json b/config/lang/en.json index e51be7228b7c2ce9224fc5a8aa9fe7ea9701d5a3..749b76cd247777fa91f9550fa9a167750c3dcffe 100644 --- a/config/lang/en.json +++ b/config/lang/en.json @@ -153,7 +153,7 @@ "page-accept-error-cannot-accept-phase": "The phase [%s] cannot be accepted.", "page-accept-info": "The software was tested successfully in phase <span class=\"%s\">%s</span> and shall be rolled out in the next phase <span class=\"%s\">%s</span>?", "page-accept-warning-version-exists-in-next-queue": "In the queue of phase [%s] the version [%s] already exists!", - "page-accept-warning-version-exists-in-next-repo": "In the phase [%s] the version [%s] is in the puppet repository already!", + "page-accept-warning-version-exists-in-next-repo": "In the install directory phase [%s] the version of [%s] already exists!", "page-accept-buttonlabel": "Accept phase [%s] and rollout to phase[%s]", "page-build-info": "Build a new package and rollout to first active phase <em class=\"%s\">%s</em>.", diff --git a/public_html/deployment/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php index 282ae6d5de3656f2632b0f85600b633386b10f5b..e8720bc9dad0dd854893d721072cfc507d2a8ea4 100644 --- a/public_html/deployment/classes/formgen.class.php +++ b/public_html/deployment/classes/formgen.class.php @@ -260,7 +260,7 @@ class formgen { $this->_checkReqiredKeys($elementData, array("name")); $sFormElement.=' <input type="'.$elementData["type"].'" id="' . $sId . '" class="form-control col-sm-10" '; $aAllowedHtmlAttributes["text"] = explode(",", ""); - $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes,name,list,disabled,onkeyup,onkeydown,onchange,pattern,placeholder,required,size,value"), $elementData); + $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes,name,autofocus,list,disabled,onkeyup,onkeydown,onchange,pattern,placeholder,required,size,value"), $elementData); // $sFormElement.=$this->_addHtmlAtrributes(array("name", "value", "size", "placeholder", "required"), $elementData); // IE: Return abfangen lassen // $sFormElement.=' onkeypress="return checkKey(event);"'; diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 4ed505a7e2da966d940321b63601988ef7b9be6c..cc1ef3aaeec4856cc79a798156ff6b2a17ff2135 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -2422,7 +2422,7 @@ class project extends base { // color ranges in decimal values for RGB from ... to $iFgStart=60; $iFgEnd=160; - $iBgStart=220; $iBgEnd=240; + $iBgStart=200; $iBgEnd=250; // deivider: 3 digits of md5 will be extracted $iFgDivider=16*16*16/($iFgEnd-$iFgStart); diff --git a/public_html/deployment/pages/act_checkssh.php b/public_html/deployment/pages/act_checkssh.php new file mode 100644 index 0000000000000000000000000000000000000000..a25438ced3716083f3feb93c3c4d90bda40ccadb --- /dev/null +++ b/public_html/deployment/pages/act_checkssh.php @@ -0,0 +1,83 @@ +<?php + +/* ###################################################################### + + IML DEPLOYMENT + + webgui - check all ssh connections to puppet, git repos and taregt hosts + + --------------------------------------------------------------------- + 2018-02-01 Axel <axel.hahn@iml.unibe.ch> + ###################################################################### */ + +$sOK='<span class="ok">' . t('ok') . '</span>'; +$sFAILED='<span class="error">' . t('error') . '</span>'; +global $sOK; +global $sFAILED; + +// test only +// $aConfig['mirrorPackages']=array('puppet' => array('target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment'),); + +/** + * exec a command and show OK or FAILED + * + * @global string $sOK + * @global string $sFAILED + * @param string $sCmd command to execute + * @return string + */ +function myExec($sCmd){ + global $sOK, $sFAILED; + $sReturn=''; + + exec($sCmd . " 2>&1 && echo '$sOK' || echo '$sFAILED' ", $aOut); + $sReturn .= "<pre><strong>\$ $sCmd</strong><br>" + . implode('<br>', $aOut)."<br>" + . "</pre>"; + + return $sReturn; +} + + +$sOut = '<h2>SSH</h2>'; + +if(isset($aConfig['mirrorPackages']) && count($aConfig['mirrorPackages'])){ + // test puppet + $sOut = '<h3>Puppet</h3>' + . '<ul>'; + foreach ($aConfig['mirrorPackages'] as $sServer=>$aSettings) { + $sCmd = 'ssh ' . preg_replace('#\:\/.*#', '' , $aSettings['target']) . ' echo "hello from `hostname -f`"'; + $sOut .= '<li><strong>' . $sServer . '</strong> ' . myExec($sCmd); + } + $sOut.='</ul>'; +} + +// ... then loop over all projects ... +$oPrj1 = new project(); +foreach ($oPrj1->getProjects() as $sPrj) { + $oPrj = new project($sPrj); + $aPrjConfig = $oPrj->getConfig(); + $sOut .= '<h3>' . $oPrj->getLabel() . '</h3>' + // . '<pre>'.print_r($aPrjConfig, 1).'</pre>' + . '<ul>'; + + // test repository + $sOut .= '<li>'.t('repositoryinfos').' <strong>' . $aPrjConfig['build']['url'] . '</strong> - ' + . ($oPrj->getRepoRevision() ? $sOK : $sFAILED) + ; + + // loop over phases ... + foreach (array_keys($oPrj->getPhases()) as $sPhase) { + $sOut .= '<li>'.t('phase').' <strong>' . $sPhase . '</strong><ul>'; + $sDeployhosts = array_key_exists("hosts", $aPrjConfig["phases"][$sPhase]) ? $aPrjConfig["phases"][$sPhase]["hosts"] : ""; + + if ($sDeployhosts) { + $sOut .= '<li>' . $sDeployhosts . '<br>'; + $sCmd = 'ssh ' . $aConfig["installPackages"]["user"] . '@' . $sDeployhosts . ' echo "hello from `hostname -f`"'; + $sOut.= myExec($sCmd); + } + $sOut.='</ul>'; + } + $sOut.='</ul>'; +} +echo $sOut; diff --git a/public_html/deployment/pages/act_login.php b/public_html/deployment/pages/act_login.php index 0c6634a96435eb818f82947df5c8b9c220ea8f60..4c4f17fcbe12568d667dde881c8c777d332af5d5 100644 --- a/public_html/deployment/pages/act_login.php +++ b/public_html/deployment/pages/act_login.php @@ -96,6 +96,12 @@ if ($oUser->getUsername()) { 'size' => 10, 'value' => $aParams['user'], 'placeholder' => t('page-login-username'), + 'autofocus' => 'autofocus', + 'inline' => '1', + ), + 'input' . $i++ => array( + 'type' => 'markup', + 'value' => '<div style="clear: both; "></div>' ), 'input' . $i++ => array( 'type' => 'password', @@ -106,11 +112,12 @@ if ($oUser->getUsername()) { 'size' => 10, 'value' => $aParams['password'], 'placeholder' => t('page-login-password'), + 'inline' => '1', ), 'input' . $i++ => array( 'type' => 'markup', 'value' => '<div style="clear: both; margin-bottom: 3em;"></div>' - . '<div style="text-align: center">' + . '<div style="text-align: left; margin-left: 12em;">' ), 'input' . $i++ => array( 'type' => 'submit',