diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py index 56c8c47..bfaf5ab 100644 --- a/tuned/plugins/plugin_bootloader.py +++ b/tuned/plugins/plugin_bootloader.py @@ -188,7 +188,8 @@ class BootloaderPlugin(base.Plugin): def _install_initrd(self, img): log.info("installing initrd image as '%s'" % self._initrd_dst_img_val) img_name = os.path.basename(self._initrd_dst_img_val) - self._cmd.copy(img, self._initrd_dst_img_val) + if not self._cmd.copy(img, self._initrd_dst_img_val): + return False self.update_grub2_cfg = True curr_cmdline = self._cmd.read_file("/proc/cmdline").rstrip() initrd_grubpath = "/" @@ -198,6 +199,7 @@ class BootloaderPlugin(base.Plugin): if len(path) < lc: initrd_grubpath = path self._initrd_val = os.path.join(initrd_grubpath, img_name) + return True @command_custom("grub2_cfg_file") def _grub2_cfg_file(self, enabling, value, verify, ignore_missing): @@ -237,7 +239,8 @@ class BootloaderPlugin(base.Plugin): self._init_initrd_dst_img(src_img) if src_img == "": return False - self._install_initrd(src_img) + if not self._install_initrd(src_img): + return False @command_custom("initrd_add_dir", per_device = False, priority = 10) def _initrd_add_dir(self, enabling, value, verify, ignore_missing): diff --git a/tuned/utils/commands.py b/tuned/utils/commands.py index f4379a8..084dc80 100644 --- a/tuned/utils/commands.py +++ b/tuned/utils/commands.py @@ -158,9 +158,11 @@ class commands: try: log.debug("copying file '%s' to '%s'" % (src, dst)) shutil.copy(src, dst) + return True except IOError as e: if not no_error: log.error("cannot copy file '%s' to '%s': %s" % (src, dst, e)) + return False def replace_in_file(self, f, pattern, repl): data = self.read_file(f)