summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceConfigDrive.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-02 15:18:27 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-02 15:18:27 -0400
commitd709524941ba2b4e06940a9eb0861f0819d5560f (patch)
tree4b26a3460b2607c4cbf1232355c000a19cb9c60a /cloudinit/sources/DataSourceConfigDrive.py
parentbd31ab1e78f59c88b4aba031ffdaca506b3b04ae (diff)
downloadvyos-cloud-init-d709524941ba2b4e06940a9eb0861f0819d5560f.tar.gz
vyos-cloud-init-d709524941ba2b4e06940a9eb0861f0819d5560f.zip
re-add the 'Net' classes for datasources
When the .pkl file is loaded, the module that it is loaded from must have the same symbol. Ie, if booted once and got DataSourceConfigDriveNet then upgraded and rebooted, then next boot would show Can't get attribute 'DataSourceConfigDriveNet'
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r--cloudinit/sources/DataSourceConfigDrive.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 2d13a32f..61d967d9 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -254,17 +254,6 @@ def find_candidate_devs(probe_optical=True):
return devices
-# Used to match classes to dependencies
-datasources = [
- (DataSourceConfigDrive, (sources.DEP_FILESYSTEM, )),
-]
-
-
-# Return a list of data sources that match this set of dependencies
-def get_datasource_list(depends):
- return sources.list_from_depends(depends, datasources)
-
-
# Convert OpenStack ConfigDrive NetworkData json to network_config yaml
def convert_network_data(network_json=None):
"""Return a dictionary of network_config by parsing provided
@@ -382,3 +371,17 @@ def convert_network_data(network_json=None):
config.append(cfg)
return {'version': 1, 'config': config}
+
+
+# Legacy: Must be present in case we load an old pkl object
+DataSourceConfigDriveNet = DataSourceConfigDrive
+
+# Used to match classes to dependencies
+datasources = [
+ (DataSourceConfigDrive, (sources.DEP_FILESYSTEM, )),
+]
+
+
+# Return a list of data sources that match this set of dependencies
+def get_datasource_list(depends):
+ return sources.list_from_depends(depends, datasources)