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

Method defaultroute_exists

systemvm/debian/opt/cloud/bin/cs/CsRoute.py:114–126  ·  view source on GitHub ↗

Return True if a default route is present :return: bool

(self)

Source from the content-addressed store, hash-verified

112 return True
113
114 def defaultroute_exists(self):
115 """ Return True if a default route is present
116 :return: bool
117 """
118 logging.info("Checking if default IPv4 route is present")
119 route_found = CsHelper.execute("ip -4 route list 0/0")
120
121 if len(route_found) > 0:
122 logging.info("Default route found: " + route_found[0])
123 return True
124 else:
125 logging.warn("No default route found!")
126 return False
127
128 def add_or_change_defaultroute(self, gateway):
129 """ Add a default route if not found, or change the default route if found

Callers 3

add_defaultrouteMethod · 0.95

Calls 2

executeMethod · 0.65
infoMethod · 0.45

Tested by 1