summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceConfigDrive.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2016-03-24 13:41:25 -0500
committerRyan Harper <ryan.harper@canonical.com>2016-03-24 13:41:25 -0500
commit9c0b3fc96fc33107dde8e89b02a63dbfb04e207c (patch)
tree3dabdc7752c41a86fd5c63118dd665c5b3977aa3 /cloudinit/sources/DataSourceConfigDrive.py
parent32e81553907eaba84345252527f208d29151620f (diff)
downloadvyos-cloud-init-9c0b3fc96fc33107dde8e89b02a63dbfb04e207c.tar.gz
vyos-cloud-init-9c0b3fc96fc33107dde8e89b02a63dbfb04e207c.zip
fix review comments
net: add render_route comment to document why we added || true to route statements DataSourceConfigDrive: Only convert network_json to network_config when caller reads network_config attr. Cache the conversion.
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index db813f6e..14676f97 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -153,9 +153,6 @@ class DataSourceConfigDrive(openstack.SourceMixin, sources.DataSource):
LOG.warn("Invalid content in network-data: %s", e)
self.network_json = None
- if self.network_json:
- self._network_config = convert_network_data(self.network_json)
-
return True
def check_instance_id(self):
@@ -164,6 +161,9 @@ class DataSourceConfigDrive(openstack.SourceMixin, sources.DataSource):
@property
def network_config(self):
+ if self._network_config is None:
+ if self.network_json is not None:
+ self._network_config = convert_network_data(self.network_json)
return self._network_config