CLOUDSTACK-8915 - Copy the conntrackd configuration every time _redundant_on() function is called

- Also refactored the copy() function under CsHelper.py
This commit is contained in:
Wilder Rodrigues 2015-10-05 11:30:18 +02:00
parent a0c93e7778
commit 9fe040e96d
2 changed files with 5 additions and 8 deletions

View File

@ -213,12 +213,7 @@ def copy_if_needed(src, dest):
"""
if os.path.isfile(dest):
return
try:
shutil.copy2(src, dest)
except IOError:
logging.Error("Could not copy %s to %s" % (src, dest))
else:
logging.info("Copied %s to %s" % (src, dest))
copy(src, dest)
def copy(src, dest):
"""

View File

@ -99,10 +99,12 @@ class CsRedundant(object):
CsHelper.copy_if_needed(
"%s/%s" % (self.CS_TEMPLATES_DIR, "keepalived.conf.templ"), self.KEEPALIVED_CONF)
CsHelper.copy_if_needed(
"%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ"), self.CONNTRACKD_CONF)
CsHelper.copy_if_needed(
"%s/%s" % (self.CS_TEMPLATES_DIR, "checkrouter.sh.templ"), "/opt/cloud/bin/checkrouter.sh")
#The file is always copied so the RVR doesn't't get the wrong config.
#Concerning the r-VPC, the configuration will be applied in a different manner
CsHelper.copy(
"%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ"), self.CONNTRACKD_CONF)
CsHelper.execute(
'sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived')