mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8952 - Make sure the calls to CsFile use the new logic of commit/is_changed methods
- We now have to check if the file changed before commiting. Doesn't make sense to write on disk if there was nono change.
This commit is contained in:
parent
1886c4a1b3
commit
2b286ecd73
@ -481,11 +481,11 @@ class CsSite2SiteVpn(CsDataBag):
|
||||
file.addeq(" dpddelay=30")
|
||||
file.addeq(" dpdtimeout=120")
|
||||
file.addeq(" dpdaction=restart")
|
||||
file.commit()
|
||||
secret = CsFile(vpnsecretsfile)
|
||||
secret.search("%s " % leftpeer, "%s %s: PSK \"%s\"" % (leftpeer, rightpeer, obj['ipsec_psk']))
|
||||
secret.commit()
|
||||
if secret.is_changed() or file.is_changed():
|
||||
secret.commit()
|
||||
file.commit()
|
||||
logging.info("Configured vpn %s %s", leftpeer, rightpeer)
|
||||
CsHelper.execute("ipsec auto --rereadall")
|
||||
CsHelper.execute("ipsec --add vpn-%s" % rightpeer)
|
||||
|
||||
@ -95,22 +95,6 @@ class CsAddress(CsDataBag):
|
||||
return ip
|
||||
return None
|
||||
|
||||
def check_if_link_exists(self,dev):
|
||||
cmd="ip link show dev %s"%dev
|
||||
result = CsHelper.execute(cmd)
|
||||
if(len(result) != 0):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def check_if_link_up(self,dev):
|
||||
cmd="ip link show dev %s | tr '\n' ' ' | cut -d ' ' -f 9"%dev
|
||||
result = CsHelper.execute(cmd)
|
||||
if(result and result[0].lower() == "up"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def process(self):
|
||||
for dev in self.dbag:
|
||||
if dev == "id":
|
||||
|
||||
@ -50,8 +50,8 @@ class CsApache(CsApp):
|
||||
file.search("Listen .*:80", "Listen %s:80" % (self.ip))
|
||||
file.search("Listen .*:443", "Listen %s:443" % (self.ip))
|
||||
file.search("ServerName.*", "\tServerName vhost%s.cloudinternal.com" % (self.dev))
|
||||
file.commit()
|
||||
if file.is_changed():
|
||||
file.commit()
|
||||
CsHelper.service("apache2", "restart")
|
||||
|
||||
self.fw.append(["", "front",
|
||||
|
||||
@ -125,7 +125,6 @@ class CsRedundant(object):
|
||||
" auth_type AH \n", " auth_pass %s\n" % self.cl.get_router_password()])
|
||||
keepalived_conf.section(
|
||||
"virtual_ipaddress {", "}", self._collect_ips())
|
||||
keepalived_conf.commit()
|
||||
|
||||
# conntrackd configuration
|
||||
conntrackd_template_conf = "%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ")
|
||||
@ -187,6 +186,7 @@ class CsRedundant(object):
|
||||
|
||||
proc = CsProcess(['/usr/sbin/keepalived'])
|
||||
if not proc.find() or keepalived_conf.is_changed():
|
||||
keepalived_conf.commit()
|
||||
CsHelper.service("keepalived", "restart")
|
||||
|
||||
def release_lock(self):
|
||||
@ -297,7 +297,6 @@ class CsRedundant(object):
|
||||
route.add_defaultroute(gateway)
|
||||
except:
|
||||
logging.error("ERROR getting gateway from device %s" % dev)
|
||||
|
||||
else:
|
||||
logging.error("Device %s was not ready could not bring it up" % dev)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user