Zppix has submitted this change and it was merged.
Change subject: Add a new grrrit-wm: nick and grrrit-wm: force-restart command
to grrrit-wm bot
......................................................................
Add a new grrrit-wm: nick and grrrit-wm: force-restart command to grrrit-wm bot
grrrit-wm: nick:
This new command can change the nick back to the original if it manages to do
nick + 1, for example grrrit-wm1 will be changed back to grrrit-wm if the nick
is available.
grrrit-wm: force-restart
This new command disconnects it from ssh and irc and then reconnects to
irc and ssh.
Also improve logging.
Change-Id: I96cd194c29d45a0068c30e6908b07dcadf7f9377
---
M src/relay.js
1 file changed, 54 insertions(+), 13 deletions(-)
Approvals:
Paladox: Looks good to me, but someone else must approve
Zppix: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/relay.js b/src/relay.js
index 69133a3..e14eba1 100644
--- a/src/relay.js
+++ b/src/relay.js
@@ -53,7 +53,13 @@
console.log('Client error: ' + err);
}).on('close', function() {
console.log('Client disconnected');
+
+ logging.info('re-connecting to irc.');
+
handle = setInterval(startRelay, 10000);
+
+ logging.info('re-connected to irc.');
+
console.log('Client re-connected');
}).connect({
host: host,
@@ -185,22 +191,57 @@
ircClient.whois(from, function(info){
- if (
- text.indexOf('grrrit-wm: restart') === 0 &&
(whitelist_cloaks.indexOf(info.host) >= 0 ||
- whitelist_nicks.indexOf(from) >= 0)
- ) {
- console.log(from + ' => ' + to + ' ' + text);
- logging.info('Connecting to gerrit..');
+ if (
+ text.indexOf('grrrit-wm: restart') === 0 &&
(whitelist_cloaks.indexOf(info.host) >= 0 ||
+ whitelist_nicks.indexOf(from) >= 0)
+ ) {
+ console.log(from + ' => ' + to + ' ' + text);
- ircClient.say(to, "re-connecting to gerrit");
+ logging.info('re-connecting to gerrit..');
- if (sshConn) {
- sshConn.end();
- }
+ ircClient.say(to, "re-connecting to gerrit");
- ircClient.say(to, "reconnected to gerrit");
- }
+ if (sshConn) {
+ sshConn.end();
+ }
+ ircClient.say(to, "reconnected to gerrit");
+ }
+
+ if (
+ text.indexOf('grrrit-wm: force-restart') === 0 &&
(whitelist_cloaks.indexOf(info.host) >= 0 ||
+ whitelist_nicks.indexOf(from) >= 0)
+ ) {
+ console.log(from + ' => ' + to + ' ' + text);
+
+ ircClient.say(to, "re-connecting to gerrit and irc.");
+
+ logging.info('Disconnecting from irc.');
+
+ ircClient.send('QUIT', "quit");
+
+ logging.info('re-connecting to gerrit..');
+
+ if (sshConn) {
+ sshConn.end();
+ }
+
+ logging.info('re-connected to gerrit.');
+
+ setTimeout(function(){ ircClient.say(to, "re-connected to gerrit
and irc."); }, 17000);
+ }
+
+ if (
+ text.indexOf('grrrit-wm: nick') === 0 &&
(whitelist_cloaks.indexOf(info.host) >= 0 ||
+ whitelist_nicks.indexOf(from) >= 0)
+ ) {
+ console.log(from + ' => ' + to + ' ' + text);
+
+ logging.info('Changing nick');
+
+ ircClient.send('NICK', config.nick);
+
+ logging.info('changed nick to' + config.nick);
+ }
});
-
});
--
To view, visit https://gerrit.wikimedia.org/r/319908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I96cd194c29d45a0068c30e6908b07dcadf7f9377
Gerrit-PatchSet: 13
Gerrit-Project: labs/tools/grrrit
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Zppix <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits