-
Notifications
You must be signed in to change notification settings - Fork 0
/
blackout.py
31 lines (28 loc) · 1.13 KB
/
blackout.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Welcome message in Log output
if releaseVariables['enableBlackout']:
print "## Enabling 'Postpone during blackout' on all tasks on all templates"
else:
print "## Clearing 'Postpone during blackout' on all tasks on all templates"
# Recursively process (nested) tasks
def processTask(task, level):
print ' ' * level + "- {}".format(task.title)
if task.isTaskGroup():
for subtask in task.children:
processTask(subtask, level + 1)
else:
# Set blackout flag and save task
task.delayDuringBlackout = releaseVariables['enableBlackout']
taskApi.updateTask(task)
# Get all templates
# Note that the response is paged, so adjust logic when you have more than 100 templates
templates = templateApi.getTemplates(None)
# Process templates
for template in templates:
print "Processing template **{}**".format(template.title)
# Load full template to get access to phases and tasks
template = templateApi.getTemplate(template.id)
for phase in template.phases:
print " * Phase **{}**".format(phase.title)
for task in phase.tasks:
processTask(task, 2)
print