Skip to content

Commit 86495b0

Browse files
committed
Deploy script for Windows now use PowerShell
Automatic icinga reload after successfull Configuration files generation Deploying new script C:\Program Files\NSClient++\refresh.ps1 Main page switched to English language
1 parent 65a4510 commit 86495b0

15 files changed

Lines changed: 222 additions & 135 deletions

debian/changelog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
icinga-editor (1.1.2-24) UNRELEASED; urgency=medium
1+
icinga-editor (1.1.2-25) UNRELEASED; urgency=medium
22

33
[ dvorak ]
44
* Initial release. (Closes: #XXXXXX)
@@ -118,5 +118,6 @@ icinga-editor (1.1.2-24) UNRELEASED; urgency=medium
118118
* Fixed Scripts Edit/Upload Switching strings to English
119119
* Fixed Scripts Edit/Upload Switching strings to English
120120
* Fixed Scripts Edit/Upload Switching strings to English
121+
* Support for ShutDown & Up scripts to start/stop icinga
121122

122-
-- vitex <vitex@developer.kancl.brevnov.czf> Fri, 12 Aug 2016 19:27:30 +0200
123+
-- vitex <vitex@developer.kancl.brevnov.czf> Tue, 16 Aug 2016 19:03:04 +0200

debian/conf/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vitexsoftware/icinga-editor",
33
"description": "Editor of Icinga Configuration files (debianized)",
4-
"version": "1.1.2.24",
4+
"version": "1.1.2.25",
55
"license": "GPL-2.0",
66
"authors": [
77
{

debian/install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ bin/iecfgimporter.php usr/bin
2222
bin/toicmdfile.sh usr/bin
2323

2424
locale/cs_CZ/LC_MESSAGES/*.mo usr/share/locale/cs_CZ/LC_MESSAGES
25-
locale/en_US/LC_MESSAGES/*.mo usr/share/locale/cs_CZ/LC_MESSAGES
25+
locale/en_US/LC_MESSAGES/*.mo usr/share/locale/en_US/LC_MESSAGES

debian/revison

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24
1+
25

src/apply.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
namespace Icinga\Editor;
44

55
/**
6-
* Icinga Editor - generování konfigurace
6+
* Icinga Editor - Configuration Generating
77
*
88
* @package IcingaEditor
9-
* @subpackage WebUI
109
* @author Vitex <vitex@hippy.cz>
11-
* @copyright 2012 Vitex@hippy.cz (G)
10+
* @copyright 2012-2016 Vitex@hippy.cz (G)
1211
*/
1312
require_once 'includes/IEInit.php';
1413

@@ -56,9 +55,9 @@
5655
if (($line === false) && ($line_num == 1)) {
5756
$errorLine = $oPage->container->addItem(new \Ease\Html\Div('<span class="label label-important">'._('Chyba:').'</span>',
5857
['class' => 'alert alert-danger']));
59-
$oUser->addStatusMessage(_('Kontrola konfigurace nevrátila výsledek.'),
58+
$oUser->addStatusMessage(_('Configuration control empty result'),
6059
'error');
61-
$errorLine->addItem(_('Zkontroluj prosím zdlali nechybí potřebný fragment v /etc/sudoers:'));
60+
$errorLine->addItem(_('Please check if /etc/sudoers contains:'));
6261
$errorLine->addItem(new \Ease\Html\Div('User_Alias APACHE = www-data'));
6362
$errorLine->addItem(new \Ease\Html\Div('Cmnd_Alias ICINGA = /usr/sbin/icinga, /etc/init.d/icinga'));
6463
$errorLine->addItem(new \Ease\Html\Div('APACHE ALL = (ALL) NOPASSWD: ICINGA'));
@@ -67,18 +66,18 @@
6766

6867
if (strstr($line, 'Error:')) {
6968
$line = str_replace('Error:', '', $line);
70-
$errorLine = $oPage->container->addItem(new \Ease\Html\Div('<span class="label label-important">'._('Chyba:').'</span>',
69+
$errorLine = $oPage->container->addItem(new \Ease\Html\Div('<span class="label label-important">'._('Error:').'</span>',
7170
['class' => 'alert alert-danger']));
7271

7372
$keywords = preg_split("/['(.*)']+/", $line);
7473
switch (trim($keywords[0])) {
7574
case 'Service notification period':
76-
$errorLine->addItem(' <a href="timeperiods.php">'._('Notifikační perioda').'</a> služeb ');
75+
$errorLine->addItem(' <a href="timeperiods.php">'._('Notification period').'</a> of services ');
7776
$errorLine->addItem(new \Ease\Html\ATag('timeperiod.php?timeperiod_name='.$keywords[1],
7877
$keywords[1]));
7978
break;
8079
case 'Host notification period':
81-
$errorLine->addItem(' <a href="timeperiods.php">'._('Notifikační perioda').'</a> hostů');
80+
$errorLine->addItem(' <a href="timeperiods.php">'._('Notification period').'</a> of hosts');
8281
$errorLine->addItem(new \Ease\Html\ATag('timeperiod.php?timeperiod_name='.$keywords[1],
8382
$keywords[1]));
8483
break;
@@ -91,7 +90,7 @@
9190
if (isset($keywords[2])) {
9291
switch (trim($keywords[2])) {
9392
case 'specified for contact':
94-
$errorLine->addItem(' specifikovaná pro kontakt ');
93+
$errorLine->addItem(' specified for contact ');
9594
$contact = new Engine\Contact($keywords[3]);
9695
$errorLine->addItem(new \Ease\Html\ATag('contact.php?contact_id='.$contact->getMyKey(),
9796
$keywords[3]));
@@ -104,11 +103,10 @@
104103
if (isset($keywords[4])) {
105104
switch (trim($keywords[4])) {
106105
case 'is not defined anywhere!':
107-
$errorLine->addItem(' není nikde definován/a ');
106+
$errorLine->addItem(''._('is not defined anywhere'));
108107
break;
109108
}
110109
}
111-
//$OPage->addItem('<pre>' . EaseBrick::printPreBasic($keywords) . '</pre>');
112110
}
113111

114112
if (strstr($line, 'Error in configuration file')) {
@@ -145,30 +143,32 @@
145143
if (strstr($line, 'Total Warnings')) {
146144
list($msg, $WarningCount) = explode(':', $line);
147145
if (intval(trim($WarningCount))) {
148-
$oUser->addStatusMessage(sprintf(_('celkem %s varování'),
146+
$oUser->addStatusMessage(sprintf(_('total %s warnings'),
149147
$WarningCount), 'warning');
150148
} else {
151-
$oUser->addStatusMessage(_('test proběhl bez varování'),
149+
$oUser->addStatusMessage(_('test successfully done without warnings'),
152150
'success');
153151
}
154152
}
155153
if (strstr($line, 'Total Errors')) {
156154
list($msg, $errorCount) = explode(':', $line);
157155
if (intval(trim($errorCount))) {
158-
$oUser->addStatusMessage(sprintf(_('celkem %s chyb'),
156+
$oUser->addStatusMessage(sprintf(_('total %s errors'),
159157
$errorCount), 'warning');
160158
} else {
161-
$oUser->addStatusMessage(_('test proběhl bez chyb'), 'success');
159+
$oUser->addStatusMessage(_('test successfully done without errors'),
160+
'success');
162161
}
163162
}
164163
}
165164
fclose($testing);
166165

167166
if (!intval($errorCount) && !is_null($WarningCount)) {
168167
if (Engine\Configurator::reloadIcinga()) {
169-
$oPage->container->addItem(_('Všechny vaše konfigurační soubory byly přegenerovány'));
168+
$oPage->container->addItem(_('All your configuration files was regenerated'));
169+
170170
$oPage->container->addItem(new \Ease\TWB\LinkButton('main.php',
171-
_('Hotovo').' '.\Ease\TWB\Part::GlyphIcon('ok-sign'), 'success'));
171+
_('Done').' '.\Ease\TWB\Part::GlyphIcon('ok-sign'), 'success'));
172172
\Ease\Shared::user()->setSettingValue('unsaved', false);
173173
}
174174
}

src/cfgconfirm.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,27 @@
66
* Icinga Editor - potvrzení nasazení konfigurace
77
*
88
* @package IcingaEditor
9-
* @subpackage WebUI
109
* @author Vitex <vitex@hippy.cz>
11-
* @copyright 2012 Vitex@hippy.cz (G)
10+
* @copyright 2012-2016 Vitex@hippy.cz (G)
1211
*/
1312
require_once 'includes/IEInit.php';
1413

1514
$host_id = $oPage->getRequestValue('host_id', 'int');
1615
$hash = $oPage->getRequestValue('hash');
1716

1817
if ($host_id && $hash) {
19-
$host = new Engine\Host($host_id);
18+
$host = new Engine\Host($host_id);
19+
$oUser = new \Icinga\Editor\User($host->getOwnerID());
2020
$host->setDataValue('config_hash', $hash);
2121
if ($host->saveToSQL()) {
22-
echo sprintf(_('Konfigurace %s potvrzena'), $host->getName());
22+
echo sprintf(_('Configuration Confirmed'), $host->getName());
23+
$extCmd = new ExternalCommand();
24+
$extCmd->addCommand('ADD_HOST_COMMENT;'.$host->getName().';1;'.$oUser->getUserLogin().';'._('Sensor Configuration Confirmed'));
25+
$extCmd->executeAll();
2326
} else {
24-
echo sprintf(_('Chyba potvrzení konfigurace'), $host->getName());
27+
echo sprintf(_('Configuration Confirmation Error'), $host->getName());
2528
}
26-
echo "\n<br>"._('Sledovat cestu k hostu').":\n";
29+
echo "\n<br>"._('Watch route to host').":\n";
2730

2831
if (isset($_SERVER['REQUEST_SCHEME'])) {
2932
$scheme = $_SERVER['REQUEST_SCHEME'];

src/classes/ExternalCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ public function addCommand($command)
3636
*/
3737
public function executeAll()
3838
{
39+
$results = [];
3940
foreach ($this->commands as $id => $command) {
40-
if ($this->execute($command) !== false) {
41+
$result = $this->execute($command);
42+
if ($result !== false) {
4143
unset($this->commands[$id]);
44+
$results[$command] = $result;
4245
}
4346
}
47+
return $results;
4448
}
4549

4650
/**
@@ -52,7 +56,10 @@ public function executeAll()
5256
public function execute($command)
5357
{
5458
$this->addStatusMessage('External command: '.$command);
55-
return system('sudo /usr/bin/toicmdfile.sh "['.time().'] '.$command.'"');
59+
ob_start();
60+
$result = system('sudo /usr/bin/toicmdfile.sh "['.time().'] '.$command.'"');
61+
ob_end_clean();
62+
return $result;
5663
}
5764

5865
/**

0 commit comments

Comments
 (0)