From abb3c00fadefea8056c300faf141260e124a5064 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 17 May 2016 17:29:59 -0700 Subject: 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. --- cloudinit/net/eni.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cloudinit') 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) -- cgit v1.2.3