summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-20 17:07:10 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-20 17:07:10 -0400
commit4fc10ef3f349e6280e2002d980c4c63e6a741d2f (patch)
treec67eaf601903947d866fe5d2bfdc9e8078927f4d /cloudinit/net
parent62b0593341e1a9cc1b37a00dd92c3bbf41dc3db7 (diff)
downloadvyos-cloud-init-4fc10ef3f349e6280e2002d980c4c63e6a741d2f.tar.gz
vyos-cloud-init-4fc10ef3f349e6280e2002d980c4c63e6a741d2f.zip
add a header to rendered ENI file describing its content
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/eni.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index ccd16ba7..e5ed10fd 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -303,6 +303,7 @@ class Renderer(renderer.Renderer):
if not config:
config = {}
self.eni_path = config.get('eni_path', 'etc/network/interfaces')
+ self.eni_header = config.get('eni_header', None)
self.links_path_prefix = config.get(
'links_path_prefix', 'etc/systemd/network/50-cloud-init-')
self.netrules_path = config.get(
@@ -417,7 +418,8 @@ class Renderer(renderer.Renderer):
def render_network_state(self, target, network_state):
fpeni = os.path.join(target, self.eni_path)
util.ensure_dir(os.path.dirname(fpeni))
- util.write_file(fpeni, self._render_interfaces(network_state))
+ header = self.eni_header if self.eni_header else ""
+ util.write_file(fpeni, header + self._render_interfaces(network_state))
if self.netrules_path:
netrules = os.path.join(target, self.netrules_path)