diff options
author | Scott Moser <smoser@ubuntu.com> | 2010-01-28 15:49:29 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2010-01-28 15:49:29 -0500 |
commit | f8eb4061196c8c2489ac7bf084e0fc0d3e6d27fc (patch) | |
tree | cf124cde80f291930a626874fb38b64661ee8315 /ec2init/__init__.py | |
parent | eb74cd6f36a2f4d2ebdee04d6b388834b1bc72d4 (diff) | |
download | vyos-cloud-init-f8eb4061196c8c2489ac7bf084e0fc0d3e6d27fc.tar.gz vyos-cloud-init-f8eb4061196c8c2489ac7bf084e0fc0d3e6d27fc.zip |
Add support for user defined mount points
Also, move swap to use this format for specifying mounts. That way
the user can turn off swap if they want with:
| mounts:
| - [ swap ]
Other change wrapped in here is to have DataSourceEc2 read plain text
(evalable) text for its metadata rather than pickl. This is really for
debuging anyway, so any speed difference is not important.
Diffstat (limited to 'ec2init/__init__.py')
-rw-r--r-- | ec2init/__init__.py | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/ec2init/__init__.py b/ec2init/__init__.py index c4923f1b..5405b5e4 100644 --- a/ec2init/__init__.py +++ b/ec2init/__init__.py @@ -285,43 +285,5 @@ class EC2Init: def get_hostname(self): return(self.datasource.get_hostname()) - def enable_swap(self): - swaps=[] - try: - swaps=self.datasource.getswap_devs() - except: - process = subprocess.Popen( - ['blkid', '-t', 'TYPE=swap', '-o', 'device'], - stdout=subprocess.PIPE) - (out,err)=process.communicate() - swaps=out.strip().split('\n') - - if len(swaps) == 0: return - - fstab="/etc/fstab" - f=file(fstab,"rb") - lines=f.read().split('\n') - f.close() - existing=[] - for line in lines: - try: - (dev,mp,type,opts,dump,pss)=line.split() - if dev.startswith("#"): continue - except: - continue - existing.append(dev) - - to_add=[] - for dev in swaps: - if not dev in existing: - to_add.append(dev) - - if len(to_add) == 0 : return - - f=file(fstab,"ab") - for dev in to_add: - f.write("%s\tnone\tswap\tsw\t0\t0\n" % dev) - f.close() - - subprocess.Popen(['swapon', '-a']).communicate() - + def device_name_to_device(self,name): + return(self.datasource.device_name_to_device(name)) |