summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/plugins/syslinux-disk-systembuilder_plugin.py8
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',