summaryrefslogtreecommitdiff
path: root/cloudinit/net/eni.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2016-05-17 17:29:59 -0700
committerJoshua Harlow <harlowja@gmail.com>2016-05-17 17:29:59 -0700
commitabb3c00fadefea8056c300faf141260e124a5064 (patch)
tree6bd74ae351e8332bb9150e532ee080642b4d00a3 /cloudinit/net/eni.py
parent12d7ee2cb6589b866ab26b508b15c65326481d6c (diff)
downloadvyos-cloud-init-abb3c00fadefea8056c300faf141260e124a5064.tar.gz
vyos-cloud-init-abb3c00fadefea8056c300faf141260e124a5064.zip
Don't expose anything but 'render_network_state'
This should be the visible api of a network renderer as anything more granular varies between the different render types and will not apply to those renderers.
Diffstat (limited to 'cloudinit/net/eni.py')
-rw-r--r--cloudinit/net/eni.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index b427012e..b1bdac24 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -243,7 +243,7 @@ def _parse_deb_config(path):
class Renderer(object):
"""Renders network information in a /etc/network/interfaces format."""
- def render_persistent_net(self, network_state):
+ def _render_persistent_net(self, network_state):
"""Given state, emit udev rules to map mac to ifname."""
content = ""
interfaces = network_state.get('interfaces')
@@ -256,7 +256,7 @@ class Renderer(object):
return content
- def render_route(self, route, indent=""):
+ def _render_route(self, route, indent=""):
""" When rendering routes for an iface, in some cases applying a route
may result in the route command returning non-zero which produces
some confusing output for users manually using ifup/ifdown[1]. To
@@ -300,7 +300,7 @@ class Renderer(object):
return content
- def render_interfaces(self, network_state):
+ def _render_interfaces(self, network_state):
''' Given state, emit etc/network/interfaces content '''
content = ""
@@ -352,7 +352,7 @@ class Renderer(object):
content += _iface_add_attrs(iface)
for route in network_state.get('routes'):
- content += self.render_route(route)
+ content += self._render_route(route)
# global replacements until v2 format
content = content.replace('mac_address', 'hwaddress')
@@ -366,19 +366,19 @@ class Renderer(object):
fpeni = os.path.sep.join((target, eni,))
util.ensure_dir(os.path.dirname(fpeni))
with open(fpeni, 'w+') as f:
- f.write(self.render_interfaces(network_state))
+ f.write(self._render_interfaces(network_state))
if netrules:
netrules = os.path.sep.join((target, netrules,))
util.ensure_dir(os.path.dirname(netrules))
with open(netrules, 'w+') as f:
- f.write(self.render_persistent_net(network_state))
+ f.write(self._render_persistent_net(network_state))
if links_prefix:
- self.render_systemd_links(target, network_state, links_prefix)
+ self._render_systemd_links(target, network_state, links_prefix)
- def render_systemd_links(self, target, network_state,
- links_prefix=LINKS_FNAME_PREFIX):
+ def _render_systemd_links(self, target, network_state,
+ links_prefix=LINKS_FNAME_PREFIX):
fp_prefix = os.path.sep.join((target, links_prefix))
for f in glob.glob(fp_prefix + "*"):
os.unlink(f)