Page MenuHomePhabricator
Paste P10421

template
ActivePublic

Authored by jbond on Feb 17 2020, 1:58 PM.
Tags
None
Referenced Files
F31619534: raw.txt
Feb 17 2020, 1:58 PM
Subscribers
None
REPORT_TEMPLATE = """
The following hosts are running the latest OS(es)
{hosts_current}
{targets_planned}
The following hosts are lagging behind the target date:
{hosts_delayed}
The following hosts are missing in the migration data
{hosts_needdata}
The following hosts are missing a migration date
{hosts_needplan}
The following errors were reported (malformed data)
{status_log}
The remaining work is targeted for the following quarters:
A total number of {hosts_current_count} hosts are running the latest OS".
{targets_plan}
A total number of {hosts_inplan_count} hosts are being migrated and according to plan.
A total number of {hosts_delayed_count} hosts are being migrated and lagging behind plan.
A total number of {hosts_needata_count} hosts need further migration data.
A total number of {hosts_needplan} hosts need further planning/discussion
"""
targets_planned = ''
targets_plan = ''
for i in sorted(targets):
targets_planned += '\n\n\nThe following hosts are planned for {} ' \
'and are in plan:\n{}'.format(i, '\n'.join(sorted(targets[i])))
targets_plan += "- {} systems are planned for {}\n".format(len(targets[i]), i)
report.write(REPORT_TEMPLATE.format(
hosts_current = sorted(hosts_current),
targets_planned = targets_planned,
hosts_delayed = sorted(hosts_delayed),
hosts_needdata = sorted(hosts_needdata),
hosts_needplan = sorted(hosts_needplan),
status_log = sorted(status_log),
hosts_current_count = len(hosts_current),
targets_plan = targets_plan,
hosts_inplan_count = len(hosts_inplan),
hosts_delayed_count = len(hosts_delayed),
hosts_needata_count = len(hosts_needata),
hosts_needplan_count = len(hosts_inplan),
))