summaryrefslogtreecommitdiffstats
path: root/hooks/charmhelpers/contrib/network/ufw.py
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/charmhelpers/contrib/network/ufw.py')
-rw-r--r--hooks/charmhelpers/contrib/network/ufw.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/hooks/charmhelpers/contrib/network/ufw.py b/hooks/charmhelpers/contrib/network/ufw.py
index 5cff71b..5db622f 100644
--- a/hooks/charmhelpers/contrib/network/ufw.py
+++ b/hooks/charmhelpers/contrib/network/ufw.py
@@ -151,6 +151,29 @@ def enable(soft_fail=False):
return True
+def reload():
+ """
+ Reload ufw
+
+ :returns: True if ufw is successfully enabled
+ """
+ output = subprocess.check_output(['ufw', 'reload'],
+ universal_newlines=True,
+ env={'LANG': 'en_US',
+ 'PATH': os.environ['PATH']})
+
+ m = re.findall('^Firewall reloaded\n',
+ output, re.M)
+ hookenv.log(output, level='DEBUG')
+
+ if len(m) == 0:
+ hookenv.log("ufw couldn't be reloaded", level='WARN')
+ return False
+ else:
+ hookenv.log("ufw reloaded", level='INFO')
+ return True
+
+
def disable():
"""
Disable ufw

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git