diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-08-06 12:35:21 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-08-06 12:35:21 +0000 |
commit | dd3956a3ac7476026b863bc6b097020d18a3347d (patch) | |
tree | cf5ffd13f926e95692b59d64440fc9b451a1c574 | |
parent | af3c13a36819ff6f80fe06f236c407c836449eca (diff) | |
download | morph-dd3956a3ac7476026b863bc6b097020d18a3347d.tar.gz |
Raise Error if install_mbr fails
-rw-r--r-- | morphlib/plugins/syslinux-disk-systembuilder_plugin.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/morphlib/plugins/syslinux-disk-systembuilder_plugin.py b/morphlib/plugins/syslinux-disk-systembuilder_plugin.py index 8bd5ca11..3f8ddea8 100644 --- a/morphlib/plugins/syslinux-disk-systembuilder_plugin.py +++ b/morphlib/plugins/syslinux-disk-systembuilder_plugin.py @@ -103,11 +103,19 @@ class SyslinuxDiskBuilder(SystemKindBuilder): # pragma: no cover if arch not in ('x86', 'x86_64'): return with self.build_watch('install-mbr'): + mbr_installed = False for path in self.app.settings['syslinux-mbr-search-paths']: if os.path.exists(path): self.app.runcmd(['dd', 'if=' + path, 'of=' + image_name, 'conv=notrunc']) + mbr_installed = True break + # A flag, rather than an else statement is used, since it must + # fail if the search path is empty as well + if not mbr_installed: + raise morphlib.Error( + "No syslinux mbr found in search paths: %s" % + repr(self.app.settings['syslinux-mbr-search-paths'])) def _setup_device_mapping(self, image_name): self.app.status(msg='Device mapping partitions in %(filename)s', |