Skip to content

Commit 338b449

Browse files
committed
Selectively disable www.gov.uk vhost and not assets vhost
1 parent e83c0c7 commit 338b449

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

incident.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from fabric.api import *
2-
from nginx import kill as nginx_kill
3-
from puppet import disable as puppet_disable
2+
import nginx
3+
import puppet
44

55
@task
66
@roles('class-cache')
77
def fail_to_mirror():
88
"""Fails the site to the mirror"""
9-
puppet_disable()
10-
nginx_kill()
11-
print("Disabled Puppet and stopped Nginx, remember to re-enable these")
9+
puppet.disable()
10+
nginx.disable_vhost("www.gov.uk")
11+
nginx.hello_it()
12+
print("Disabled Puppet and disabled www.gov.uk vhost, remember to re-enable these")

nginx.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ def gracefulstop(wait=True):
99
# Poll for Nginx, until it's no longer running.
1010
run('while pgrep nginx >/dev/null; do echo "Waiting for Nginx to exit.."; sleep 1; done')
1111

12+
@task
13+
def disable_vhost(vhost_filename):
14+
"""Disable a vhost by removing its symlink from /etc/nginx/sites-enabled"""
15+
sudo('rm -f /etc/nginx/sites-enabled/%s' % vhost_filename)
16+
1217
@task
1318
def kill():
1419
"""Shut down Nginx immediately without waiting for it to finish running"""

0 commit comments

Comments
 (0)