summaryrefslogtreecommitdiff
path: root/morphlib/writeexts.py
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2013-05-29 11:04:27 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2013-05-29 11:39:13 +0000
commit9885b51a7a7633a5363533fa86166fc2758c080c (patch)
tree9a1d348a8ed4c0983791f28a5ffccf991d3d606e /morphlib/writeexts.py
parent85c92954fc4059a781c672a499fca773eafd6eeb (diff)
downloadmorph-9885b51a7a7633a5363533fa86166fc2758c080c.tar.gz
Make create_local_system fail if DISK_SIZE isn't defined
Diffstat (limited to 'morphlib/writeexts.py')
-rw-r--r--morphlib/writeexts.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index 9e98747c..df4cec33 100644
--- a/morphlib/writeexts.py
+++ b/morphlib/writeexts.py
@@ -53,6 +53,8 @@ class WriteExtension(cliapp.Application):
'''Create a raw system image locally.'''
size = self.get_disk_size()
+ if not size:
+ raise cliapp.AppException('DISK_SIZE is not defined')
self.create_raw_disk_image(raw_disk, size)
try:
self.mkfs_btrfs(raw_disk)
@@ -105,6 +107,8 @@ class WriteExtension(cliapp.Application):
'''Parse a size from an environment variable.'''
size = os.environ.get(env_var, default)
+ if size is None:
+ return None
bytes = self._parse_size(size)
if bytes is None:
raise morphlib.Error('Cannot parse %s value %s' % (env_var, size))
@@ -112,7 +116,7 @@ class WriteExtension(cliapp.Application):
def get_disk_size(self):
'''Parse disk size from environment.'''
- return self._parse_size_from_environment('DISK_SIZE', '1G')
+ return self._parse_size_from_environment('DISK_SIZE', None)
def get_ram_size(self):
'''Parse RAM size from environment.'''