You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/20 08:01:08 UTC

[03/13] git commit: updated refs/heads/master to 6fe5ae0

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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2b286ecd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2b286ecd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2b286ecd

Branch: refs/heads/master
Commit: 2b286ecd730763a472fff2071a8fd7166692e11f
Parents: 1886c4a
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Oct 15 16:43:29 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Sat Oct 17 12:20:40 2015 +0200

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py        |  4 ++--
 .../debian/config/opt/cloud/bin/cs/CsAddress.py     | 16 ----------------
 .../patches/debian/config/opt/cloud/bin/cs/CsApp.py |  2 +-
 .../debian/config/opt/cloud/bin/cs/CsRedundant.py   |  3 +--
 4 files changed, 4 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b286ecd/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index 014e294..8c39f75 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -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)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b286ecd/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 0b00397..b80187a 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -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":

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b286ecd/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
index de53fe0..a0b4c6e 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
@@ -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",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b286ecd/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index 9e1f073..29f755c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -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)