Skip to content

Commit 1a8f64d

Browse files
ustcweizhouweizhouapache
authored andcommitted
apache#4141 LB config: fix many 'mkdir -p /etc/ssl/cloudstack/' in /var/log/cloud.log
1 parent 3995455 commit 1a8f64d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
HAPROXY_CONF_T = "/etc/haproxy/haproxy.cfg.new"
2727
HAPROXY_CONF_P = "/etc/haproxy/haproxy.cfg"
2828

29+
IP_ROUTE_TABLE_NUMBER_FOR_TRANSPARENCY = 99
2930
SSL_CERTS_DIR = "/etc/ssl/cloudstack/"
30-
CsHelper.execute("mkdir -p %s" % SSL_CERTS_DIR)
3131

3232

3333
class CsLoadBalancer(CsDataBag):
@@ -93,7 +93,7 @@ def _configure_firewall(self, add_rules, remove_rules, stat_rules):
9393
firewall.append(["filter", "", "-A INPUT -p tcp -m tcp -d %s --dport %s -m state --state NEW -j ACCEPT" % (ip, port)])
9494

9595
def _configure_firewall_for_transparent(self, is_transparent):
96-
tableNo = 99
96+
tableNo = IP_ROUTE_TABLE_NUMBER_FOR_TRANSPARENCY
9797
firewall = self.config.get_fw()
9898
if is_transparent is None or not is_transparent:
9999
if ["mangle", "", "-A PREROUTING -p tcp -m socket -j DIVERT"] in firewall:
@@ -116,6 +116,8 @@ def _configure_firewall_for_transparent(self, is_transparent):
116116

117117
def _create_pem_for_sslcert(self, ssl_certs):
118118
logging.debug("CsLoadBalancer:: creating new pem files in %s and cleaning up it" % SSL_CERTS_DIR)
119+
if not os.path.exists(SSL_CERTS_DIR):
120+
CsHelper.execute("mkdir -p %s" % SSL_CERTS_DIR)
119121
cert_names = []
120122
for cert in ssl_certs:
121123
cert_names.append(cert['name'] + ".pem")

0 commit comments

Comments
 (0)