summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceNoCloud.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-01-18 20:25:57 +0000
committerScott Moser <smoser@ubuntu.com>2011-01-18 20:25:57 +0000
commitc11b93cf03e4ff0dd90c83d09f27c512513be9b7 (patch)
tree02ac85268a561da63cb6dd967bd60399350227fe /cloudinit/DataSourceNoCloud.py
parente40a1c8143ee88e0eb9b979fabff587ec53b971d (diff)
downloadvyos-cloud-init-c11b93cf03e4ff0dd90c83d09f27c512513be9b7.tar.gz
vyos-cloud-init-c11b93cf03e4ff0dd90c83d09f27c512513be9b7.zip
support reading cloud_config from kernel command line
This allows the user to specify portions of the cloud-config system config on the kernel command line. values found on the kernel command line have preference over those in system config. The format is: cc:[ ]<yaml content here> [end_cc] Where: 'cc:' indicates the beginning of cloud config syntax [ ] optionally followed by whitespace (which will be trimmed) <yaml content here> : this content is passed untouched to yaml end_cc: this is optional. If no 'end_cc' tag is found, all data from the begin tag to the end of the command line is consumed Multiple occurences of the cc:<data>end_cc will be joined with carriage return before passing to yaml. Any litteral '\n' (backslash followed by lower case 'n') are converted to a carriage return. The following are examples: cc: ssh_import_id: [smoser, kirkland] cc: ssh_import_id: [smoser, bob]\\nruncmd: [ [ ls, -l ], echo hi ] end_cc cc:ssh_import_id: [smoser] end_cc cc:runcmd: [ [ ls, -l ] ] end_cc
Diffstat (limited to 'cloudinit/DataSourceNoCloud.py')
-rw-r--r--cloudinit/DataSourceNoCloud.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py
index cd988d08..78c9c9c8 100644
--- a/cloudinit/DataSourceNoCloud.py
+++ b/cloudinit/DataSourceNoCloud.py
@@ -108,16 +108,10 @@ class DataSourceNoCloud(DataSource.DataSource):
# root=LABEL=uec-rootfs ro ds=nocloud
def parse_cmdline_data(ds_id,fill,cmdline=None):
if cmdline is None:
- if 'DEBUG_PROC_CMDLINE' in os.environ:
- cmdline = os.environ["DEBUG_PROC_CMDLINE"]
- else:
- cmdfp = open("/proc/cmdline")
- cmdline = cmdfp.read().strip()
- cmdfp.close()
- cmdline = " %s " % cmdline.lower()
-
- if not ( " %s " % ds_id in cmdline or " %s;" % ds_id in cmdline ):
- return False
+ cmdline = util.get_cmdline()
+
+ if not ( " %s " % ds_id in cmdline or " %s;" % ds_id in cmdline ):
+ return False
argline=""
# cmdline can contain: