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

Function main

systemvm/debian/opt/cloud/bin/configure.py:1635–1705  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

1633 CsHelper.save_iptables("nft list ruleset", "/etc/iptables/rules.nftables")
1634
1635def main(argv):
1636 # The file we are currently processing, if it is "cmd_line.json" everything will be processed.
1637 process_file = argv[1]
1638
1639 if process_file is None:
1640 logging.debug("No file was received, do not go on processing the other actions. Just leave for now.")
1641 return
1642
1643 json_type = os.path.basename(process_file).split('.json')[0]
1644
1645 # The "GLOBAL" Configuration object
1646 config = CsConfig()
1647
1648 # Load stored ip addresses from disk to CsConfig()
1649 config.set_address()
1650
1651 logging.debug("Configuring ip addresses")
1652 config.address().compare()
1653 config.address().process()
1654
1655 databag_map = OrderedDict([("guest_network", {"process_iptables": True, "executor": [CsVpcGuestNetwork("guestnetwork", config)]}),
1656 ("bgp_peers", {"process_iptables": False, "executor": [CsBgpPeers("bgppeers", config)]}),
1657 ("ip_aliases", {"process_iptables": True, "executor": []}),
1658 ("vm_password", {"process_iptables": False, "executor": [CsPassword("vmpassword", config)]}),
1659 ("vm_metadata", {"process_iptables": False, "executor": [CsVmMetadata('vmdata', config)]}),
1660 ("network_acl", {"process_iptables": True, "executor": []}),
1661 ("firewall_rules", {"process_iptables": True, "executor": []}),
1662 ("ipv6_firewall_rules", {"process_iptables": True, "executor": []}),
1663 ("forwarding_rules", {"process_iptables": True, "executor": []}),
1664 ("staticnat_rules", {"process_iptables": True, "executor": []}),
1665 ("site_2_site_vpn", {"process_iptables": True, "executor": []}),
1666 ("remote_access_vpn", {"process_iptables": True, "executor": []}),
1667 ("vpn_user_list", {"process_iptables": False, "executor": [CsVpnUser("vpnuserlist", config)]}),
1668 ("vm_dhcp_entry", {"process_iptables": False, "executor": [CsDhcp("dhcpentry", config)]}),
1669 ("dhcp", {"process_iptables": False, "executor": [CsDhcp("dhcpentry", config)]}),
1670 ("load_balancer", {"process_iptables": True, "executor": []}),
1671 ("monitor_service", {"process_iptables": False, "executor": [CsMonitor("monitorservice", config)]}),
1672 ("static_routes", {"process_iptables": True, "executor": [CsStaticRoutes("staticroutes", config)]})
1673 ])
1674
1675 if not config.is_vpc():
1676 databag_map.pop("guest_network")
1677
1678 def execDatabag(key, db):
1679 if key not in list(db.keys()) or 'executor' not in db[key]:
1680 logging.warn("Unable to find config or executor(s) for the databag type %s" % key)
1681 return
1682 for executor in db[key]['executor']:
1683 logging.debug("Processing for databag type: %s" % key)
1684 executor.process()
1685
1686 def execIptables(config):
1687 logging.debug("Processing iptables rules")
1688 iptables_executor = IpTablesExecutor(config)
1689 iptables_executor.process()
1690
1691 if json_type == "cmd_line":
1692 logging.debug("cmd_line.json changed. All other files will be processed as well.")

Callers 1

configure.pyFile · 0.70

Calls 15

set_addressMethod · 0.95
addressMethod · 0.95
is_vpcMethod · 0.95
setMethod · 0.95
CsConfigClass · 0.90
CsVpcGuestNetworkClass · 0.90
CsBgpPeersClass · 0.90
CsDhcpClass · 0.90
CsMonitorClass · 0.90
CsStaticRoutesClass · 0.90
CsPasswordClass · 0.85
CsVmMetadataClass · 0.85

Tested by

no test coverage detected