Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a485106

Browse files
committed
Clean up public task namespace
Tasks imported into other Fabric task files are exposed publicly - see: http://docs.fabfile.org/en/latest/usage/tasks.html#namespaces This commit cleans up those imports so we don't pollute the public namespace. Fixes alphagov#120
1 parent cd34adb commit a485106

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cdn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from fabric.api import *
22

3-
from cache import purge as cache_purge
3+
import cache
44

55
@task
66
@runs_once
@@ -16,5 +16,5 @@ def fastly_purge(*args):
1616
@task
1717
def purge_all(*args):
1818
"Purge items from Fastly and cache machines, eg \"/one,/two,/three\""
19-
execute(cache_purge, *args)
19+
execute(cache.purge, *args)
2020
execute(fastly_purge, *args)

vm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from fabric.utils import error
33
import re
44

5+
import nagios
6+
57
@task
68
def uptime():
79
"""Show uptime and load"""
@@ -89,8 +91,7 @@ def reboot():
8991
@task
9092
def force_reboot():
9193
"""Schedule a host for downtime in nagios and force reboot (even if not required)"""
92-
from nagios import schedule_downtime
93-
execute(schedule_downtime, env['host_string'])
94+
execute(nagios.schedule_downtime, env['host_string'])
9495
run("sudo shutdown -r now")
9596

9697
@task
@@ -100,8 +101,7 @@ def poweroff():
100101
Usage:
101102
fab production -H frontend-1.frontend.production vm.poweroff
102103
"""
103-
from nagios import schedule_downtime
104-
execute(schedule_downtime, env['host_string'])
104+
execute(nagios.schedule_downtime, env['host_string'])
105105
run("sudo poweroff")
106106

107107
@task

0 commit comments

Comments
 (0)