|
@@ -853,14 +853,11 @@ def ffpb_rolloutstatus(bot, trigger):
|
|
|
|
|
|
# initialize results dictionary
|
|
|
result = { }
|
|
|
- for branch in [ 'stable', 'testing' ]:
|
|
|
- result[branch] = None
|
|
|
skipped = 0
|
|
|
|
|
|
- # read expected firmware version from command arguments
|
|
|
- expected_release = trigger.group(2)
|
|
|
- if expected_release is None or len(expected_release) == 0:
|
|
|
- bot.say('Von welcher Firmware denn?')
|
|
|
+ # inform users about changed command parameters
|
|
|
+ if not trigger.group(2) is None:
|
|
|
+ bot.reply('Dieses Kommando nimmt keinen Parameter mehr an.')
|
|
|
return
|
|
|
|
|
|
# check each node in ALFRED data
|
|
@@ -873,27 +870,43 @@ def ffpb_rolloutstatus(bot, trigger):
|
|
|
release = item['software']['firmware']['release']
|
|
|
branch = item['software']['autoupdater']['branch']
|
|
|
enabled = item['software']['autoupdater']['enabled']
|
|
|
- if not branch in result or result[branch] is None:
|
|
|
- result[branch] = { 'auto_count': 0, 'auto_not': 0, 'manual_count': 0, 'manual_not': 0, 'total': 0 }
|
|
|
+ if not release in result or result[release] is None:
|
|
|
+ result[release] = { 'stable': None, 'testing': None }
|
|
|
+ if not branch in result[release] or result[release][branch] is None:
|
|
|
+ result[release][branch] = { 'auto': 0, 'manual': 0, 'total': 0 }
|
|
|
|
|
|
- result[branch]['total'] += 1
|
|
|
- match = 'count' if release == expected_release else 'not'
|
|
|
+ result[release][branch]['total'] += 1
|
|
|
mode = 'auto' if enabled else 'manual'
|
|
|
- result[branch][mode+'_'+match] += 1
|
|
|
+ result[release][branch][mode] += 1
|
|
|
|
|
|
# respond to user
|
|
|
- output = "Rollout von '{0}':".format(expected_release)
|
|
|
- for branch in result:
|
|
|
- auto_count = result[branch]['auto_count']
|
|
|
- auto_total = auto_count + result[branch]['auto_not']
|
|
|
- manual_count = result[branch]['manual_count']
|
|
|
- manual_total = manual_count + result[branch]['manual_not']
|
|
|
- bot.say("Rollout von '{0}': {1} = {2}/{3} per Auto-Update, {4}/{5} manuell".format(expected_release, branch, auto_count, auto_total, manual_count, manual_total))
|
|
|
+ releases = sorted([x for x in result])
|
|
|
+ for release in releases:
|
|
|
+ output = 'Rollout von \'{0}\':'.format(release)
|
|
|
+ branches = sorted([x for x in result[release]])
|
|
|
+ first = True
|
|
|
+ for branch in branches:
|
|
|
+ item = result[release][branch]
|
|
|
+ if item is None: continue
|
|
|
+
|
|
|
+ if not first:
|
|
|
+ output += ','
|
|
|
+ first = False
|
|
|
+
|
|
|
+ total = item['total']
|
|
|
+ auto_count = item['auto']
|
|
|
+ manual_count = item['manual']
|
|
|
+
|
|
|
+ output += ' {2} {0}'.format(branch, total, auto_count, manual_count)
|
|
|
+ if manual_count > 0:
|
|
|
+ output += ' (+{3} manuell)'.format(branch, total, auto_count, manual_count)
|
|
|
+
|
|
|
+ bot.say(output)
|
|
|
|
|
|
# output count of nodes for which the autoupdater's branch and/or
|
|
|
# firmware version could not be retrieved
|
|
|
if skipped > 0:
|
|
|
- bot.say("Rollout von '{0}': {1} Knoten unklar".format(expected_release, skipped))
|
|
|
+ bot.say('plus {0} Knoten deren Status gerade nicht abfragbar war'.format(skipped))
|
|
|
|
|
|
@willie.module.commands('ping')
|
|
|
def ffpb_ping(bot, trigger=None, target_name=None):
|