Commit c583ca7e authored by Romain Courteaud's avatar Romain Courteaud

Support network interface.

This may be used by the kvm for example to get the tap interface name.
parent 0719e285
......@@ -63,6 +63,15 @@ class Recipe:
# XXX: Lack checking for globality of address
return self._getIpAddress(netaddr.valid_ipv6)
def getNetworkInterface(self):
"""Returns the network interface available on partition"""
if not 'ip_list' in self.parameter_dict:
raise AttributeError
for name, ip in self.parameter_dict['ip_list']:
if name:
return name
raise AttributeError, "Not network interface found"
def install(self):
slap = slapos.slap.slap()
slap_connection = self.buildout['slap_connection']
......@@ -107,6 +116,8 @@ class Recipe:
self.getLocalIPv4Address())
buildout.set('slap-network-information', 'global-ipv6',
self.getGlobalIPv6Address())
buildout.set('slap-network-information', 'network-interface',
self.getNetworkInterface())
# Copy/paste slap_connection
buildout.add_section('slap-connection')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment