MCPcopy Create free account
hub / github.com/apache/cloudstack / process

Method process

systemvm/debian/opt/cloud/bin/configure.py:1012–1043  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1010 VPNCONFDIR = "/etc/ipsec.d"
1011
1012 def process(self):
1013 self.confips = []
1014 # collect a list of configured vpns
1015 for file in os.listdir(self.VPNCONFDIR):
1016 m = re.search("^ipsec.vpn-(.*).conf", file)
1017 if m:
1018 self.confips.append(m.group(1))
1019
1020 for vpn in self.dbag:
1021 if vpn == "id":
1022 continue
1023
1024 local_ip = self.dbag[vpn]['local_public_ip']
1025 dev = CsHelper.get_device(local_ip)
1026
1027 if not self.config.has_public_network():
1028 interface = self.config.address().get_guest_if_by_network_id()
1029 if interface:
1030 dev = interface.get_device()
1031 local_ip = interface.get_ip()
1032
1033 if dev == "":
1034 logging.error("Request for ipsec to %s not possible because ip is not configured", local_ip)
1035 continue
1036
1037 CsHelper.start_if_stopped("ipsec")
1038 self.configure_iptables(dev, local_ip, self.dbag[vpn])
1039 self.configure_ipsec(local_ip, self.dbag[vpn])
1040
1041 # Delete vpns that are no longer in the configuration
1042 for ip in self.confips:
1043 self.deletevpn(ip)
1044
1045 def deletevpn(self, ip):
1046 logging.info("Removing VPN configuration for %s", ip)

Callers 1

processMethod · 0.95

Calls 12

configure_iptablesMethod · 0.95
configure_ipsecMethod · 0.95
deletevpnMethod · 0.95
get_deviceMethod · 0.80
has_public_networkMethod · 0.80
addressMethod · 0.80
searchMethod · 0.65
appendMethod · 0.45
groupMethod · 0.45
get_ipMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected