summaryrefslogtreecommitdiff
path: root/cloudinit/importer.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-07 12:42:38 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-07 12:42:38 -0700
commit8900f9cba622eeaf3810003c5a6ff7522312277b (patch)
tree96dd5295a29c69eabfede0630f697325149926f3 /cloudinit/importer.py
parent87ebd91af8c230b8f1deed8e734297e40397eea0 (diff)
downloadvyos-cloud-init-8900f9cba622eeaf3810003c5a6ff7522312277b.tar.gz
vyos-cloud-init-8900f9cba622eeaf3810003c5a6ff7522312277b.zip
1. Adding some new helper files that split off file inclusion, templating, importing, constant usage.
1. Move all datasources to a new sources directory 1. Rename some files to be more consistent with python file/module naming.
Diffstat (limited to 'cloudinit/importer.py')
-rw-r--r--cloudinit/importer.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/cloudinit/importer.py b/cloudinit/importer.py
new file mode 100644
index 00000000..deea0956
--- /dev/null
+++ b/cloudinit/importer.py
@@ -0,0 +1,11 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+import sys
+
+
+def import_module(module_name):
+ try:
+ __import__(module_name)
+ return sys.modules.get(module_name, None)
+ except ImportError as err:
+ raise RuntimeError('Could not load module %s: %s' % (module_name, err))