diff options
author | Neil Williams <codehelp@debian.org> | 2015-08-15 17:57:25 +0200 |
---|---|---|
committer | Neil Williams <codehelp@debian.org> | 2015-08-16 14:28:53 +0200 |
commit | 9d776bb74654b80815fe08d87b5237e577ef1099 (patch) | |
tree | 176c87e7d849637749645b86f59b09633dd12865 /vmdebootstrap | |
parent | 4076819572f4dec90050771a58a4753d20a3f68b (diff) | |
download | vmdebootstrap-9d776bb74654b80815fe08d87b5237e577ef1099.tar.gz |
fixups
Diffstat (limited to 'vmdebootstrap')
-rw-r--r-- | vmdebootstrap/base.py | 9 | ||||
-rw-r--r-- | vmdebootstrap/filesystem.py | 17 |
2 files changed, 9 insertions, 17 deletions
diff --git a/vmdebootstrap/base.py b/vmdebootstrap/base.py index 1843d56..e840855 100644 --- a/vmdebootstrap/base.py +++ b/vmdebootstrap/base.py @@ -157,15 +157,6 @@ class Base(object): "%s usage: %s", self.settings['image'], runcmd(['du', self.settings['image']])) - def optimize_image(self, rootdir): - """ - Filing up the image with zeros will increase its compression rate - """ - if not self.settings['sparse']: - zeros = os.path.join(rootdir, 'ZEROS') - self.runcmd_unchecked(['dd', 'if=/dev/zero', 'of=' + zeros, 'bs=1M']) - runcmd(['rm', '-f', zeros]) - def append_serial_console(self, rootdir): if self.settings['serial-console']: serial_command = self.settings['serial-console-command'] diff --git a/vmdebootstrap/filesystem.py b/vmdebootstrap/filesystem.py index 1ccaeed..07ec9ca 100644 --- a/vmdebootstrap/filesystem.py +++ b/vmdebootstrap/filesystem.py @@ -129,6 +129,7 @@ class Filesystem(Base): rootdev = self.devices['rootdev'] bootdev = self.devices['bootdev'] boottype = self.devices['boottype'] + roottype = self.devices['roottype'] def fsuuid(device): out = runcmd(['blkid', '-c', '/dev/null', '-o', 'value', @@ -233,8 +234,8 @@ class Filesystem(Base): if not rootdir: raise cliapp.AppException("rootdir not set") self.message('Removing udev persistent cd and net rules') - for x in ['70-persistent-cd.rules', '70-persistent-net.rules']: - pathname = os.path.join(str(rootdir), 'etc', 'udev', 'rules.d', x) + for xrule in ['70-persistent-cd.rules', '70-persistent-net.rules']: + pathname = os.path.join(str(rootdir), 'etc', 'udev', 'rules.d', xrule) if os.path.exists(pathname): logging.debug('rm %s', pathname) os.remove(pathname) @@ -246,17 +247,17 @@ class Filesystem(Base): hostname = self.settings['hostname'] if not rootdir: raise cliapp.AppException("rootdir not set") - with open(os.path.join(str(rootdir), 'etc', 'hostname'), 'w') as f: - f.write('%s\n' % hostname) + with open(os.path.join(str(rootdir), 'etc', 'hostname'), 'w') as fhost: + fhost.write('%s\n' % hostname) etc_hosts = os.path.join(str(rootdir), 'etc', 'hosts') try: - with open(etc_hosts, 'r') as f: - data = f.read() - with open(etc_hosts, 'w') as f: + with open(etc_hosts, 'r') as fhost: + data = fhost.read() + with open(etc_hosts, 'w') as fhosts: for line in data.splitlines(): if line.startswith('127.0.0.1'): line += ' %s' % hostname - f.write('%s\n' % line) + fhosts.write('%s\n' % line) except IOError: pass |