summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
diff options
context:
space:
mode:
authorRichard Holland <richard.holland@codethink.co.uk>2013-04-05 12:57:51 +0000
committerRichard Holland <richard.holland@codethink.co.uk>2013-04-08 14:46:21 +0000
commitdf440fc7d256b7a248d5a5256d4855794de64df3 (patch)
tree17bd9961091357b2b692318bc1e9f5e2c79ce3a3 /morphlib/builder2.py
parentba5edf9a0a5d4917d2f97a8421b9f00ec3f75576 (diff)
downloadmorph-df440fc7d256b7a248d5a5256d4855794de64df3.tar.gz
Changed empty stratum warning to error
Added new cliapp.AppException class to raise error when attempting to build an empty stratum (no dependencies) and raised it appropriately.
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r--morphlib/builder2.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index f8f4ea88..9382efe9 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -471,7 +471,7 @@ class StratumBuilder(BuilderBase):
constituents = [d for d in self.artifact.dependencies
if self.is_constituent(d)]
if len(constituents) == 0:
- logging.warning('Stratum %s is empty' % self.artifact.name)
+ raise EmptyStratumError(self.artifact.name)
# the only reason the StratumBuilder has to download chunks is to
# check for overlap now that strata are lists of chunks
@@ -854,3 +854,9 @@ class DiskImageBuilder(SystemKindBuilder): # pragma: no cover
filename=image_name, chatty=True)
with self.build_watch('undo-device-mapper'):
morphlib.fsutils.undo_device_mapping(self.app.runcmd, image_name)
+
+class EmptyStratumError(cliapp.AppException):
+
+ def __init__(self, stratum_name):
+ cliapp.AppException.__init__(self,
+ "Stratum %s is empty (has no dependencies)" % stratum_name)