|
@@ -122,6 +122,8 @@ def ffpb_highscore(bot, trigger):
|
|
|
highscores['clients'], pretty_date(int(highscores['clients_ts']))))
|
|
|
|
|
|
|
|
|
+MAX_ROLLOUTSTATUS_LIST = 42
|
|
|
+
|
|
|
@willie.module.commands('rollout-status')
|
|
|
def ffpb_rolloutstatus(bot, trigger):
|
|
|
"""Display statistic on how many nodes have installed which firmware."""
|
|
@@ -130,10 +132,10 @@ def ffpb_rolloutstatus(bot, trigger):
|
|
|
result = {}
|
|
|
skipped = 0
|
|
|
|
|
|
- arg = trigger.group(2)
|
|
|
+ arg = trigger.group(3)
|
|
|
# inform users about changed command parameters
|
|
|
- if arg is not None and arg != 'all':
|
|
|
- bot.reply('Dieses Kommando nimmt keinen Parameter außer \'all\' mehr an.')
|
|
|
+ if arg is not None and arg not in ['all', 'identify']:
|
|
|
+ bot.reply('Hm? !rollout-status [all|list <version>]')
|
|
|
return
|
|
|
|
|
|
# get all nodes
|
|
@@ -145,9 +147,48 @@ def ffpb_rolloutstatus(bot, trigger):
|
|
|
offlinenodes = 0
|
|
|
count_offline = (arg == "all")
|
|
|
|
|
|
+ if arg == 'list':
|
|
|
+ list_nodes = trigger.group(4)
|
|
|
+ if list_nodes is None or len(list_nodes) == 0:
|
|
|
+ bot.reply('!rollout-status list <version>')
|
|
|
+ return
|
|
|
+
|
|
|
+ result = {'stable': [], 'testing': []}
|
|
|
+ for item in nodes:
|
|
|
+ release = item.get('firmware')
|
|
|
+ if release != list_nodes:
|
|
|
+ continue
|
|
|
+
|
|
|
+ name = item.get('name', item.get('node_id'))
|
|
|
+ branch = item.get('autoupdater')
|
|
|
+ if branch in result:
|
|
|
+ result[branch].append(name)
|
|
|
+ else:
|
|
|
+ result[branch] = [name]
|
|
|
+
|
|
|
+ total = sum([len(result[x]) for x in result])
|
|
|
+ if total == 0:
|
|
|
+ bot.reply('Niemand benutzt derzeit die Version "{version}".'.format(version=list_nodes))
|
|
|
+ return
|
|
|
+
|
|
|
+ if total > MAX_ROLLOUTSTATUS_LIST:
|
|
|
+ bot.reply('Das betrifft {total} Knoten, mehr als {max} werte ich als IRC-Spam.'.format(total=total, max=MAX_ROLLOUTSTATUS_LIST))
|
|
|
+ return
|
|
|
+
|
|
|
+ for branch, nodes in result:
|
|
|
+ bot.say('{count} Knoten auf {version} "{branch}": {nodes}'.format(
|
|
|
+ branch=branch,
|
|
|
+ version=list_nodes,
|
|
|
+ count=len(nodes),
|
|
|
+ nodes=','.join(nodes),
|
|
|
+ ))
|
|
|
+
|
|
|
+ # respond to the user
|
|
|
+ return
|
|
|
+
|
|
|
# check each node in ALFRED data
|
|
|
for item in nodes:
|
|
|
- if (not count_offline) and (item.get('status') not in ['active','stale']):
|
|
|
+ if (not count_offline) and (item.get('status') not in ['active', 'stale']):
|
|
|
offlinenodes += 1
|
|
|
continue
|
|
|
|