[master 1/1] Copying same file shouldn't crash (#1269213)
by dashea
From: "Brian C. Lane" <bcl(a)redhat.com>
When using the template install command copying the same file to itself
shouldn't crash. Just log the error and continue.
Resolves: rhbz#1269213
---
src/pylorax/ltmpl.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py
index 42f5435..87fb6f5 100644
--- a/src/pylorax/ltmpl.py
+++ b/src/pylorax/ltmpl.py
@@ -26,6 +26,7 @@
import os, re, glob, shlex, fnmatch
from os.path import basename, isdir
from subprocess import CalledProcessError
+import shutil
from pylorax.sysutils import joinpaths, cpfile, mvfile, replace, remove
from pylorax.dnfhelper import LoraxDownloadCallback, LoraxRpmCallback
@@ -269,7 +270,10 @@ def install(self, srcglob, dest):
install /usr/share/myconfig/grub.conf.in /boot/grub.conf
'''
for src in rglob(self._in(srcglob), fatal=True):
- cpfile(src, self._out(dest))
+ try:
+ cpfile(src, self._out(dest))
+ except shutil.Error as e:
+ logger.error(e)
def installimg(self, *args):
'''
@@ -424,7 +428,10 @@ def copy(self, src, dest):
If DEST doesn't exist, SRC will be copied to a file with
that name, if the path leading to it exists.
'''
- cpfile(self._out(src), self._out(dest))
+ try:
+ cpfile(self._out(src), self._out(dest))
+ except shutil.Error as e:
+ logger.error(e)
def move(self, src, dest):
'''
--
To view this commit on github, visit https://github.com/rhinstaller/lorax/commit/6388d24d495da8b6841710da903d8...
8 years, 2 months
[rhel7-branch 1/1] Stop kickstart when space check fails (#1320436)
by dashea
From: "Brian C. Lane" <bcl(a)redhat.com>
Text mode kickstart behavior was inconsistent, it would allow an
installation to continue even though the space check failed. Every other
install method stops, letting the user add more space before continuing.
Resolves: rhbz#1320436
---
pyanaconda/ui/tui/hubs/summary.py | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py
index 9dab613..1e680d7 100644
--- a/pyanaconda/ui/tui/hubs/summary.py
+++ b/pyanaconda/ui/tui/hubs/summary.py
@@ -69,16 +69,20 @@ def prompt(self, args=None):
incompleteSpokes = [spoke for spoke in self._keys.values()
if spoke.mandatory and not spoke.completed]
- # do a bit of final sanity checking, make sure pkg selection
- # size < available fs space
- if flags.automatedInstall:
- if self._checker and not self._checker.check():
- print(self._checker.error_message)
- if not incompleteSpokes:
- self.close()
- return None
+ # Kickstart space check failure either stops the automated install or
+ # raises an error when using cmdline mode.
+ if flags.automatedInstall and self._checker and not self._checker.check():
+ print(self._checker.error_message)
+ if not flags.ksprompt:
+ log.error("CmdlineError: %s", self._checker.error_message)
+ raise CmdlineError(self._checker.error_message)
+ elif flags.automatedInstall and not incompleteSpokes:
+ # Space is ok and spokes are complete, continue
+ self.close()
+ return None
- if not flags.ksprompt:
+ # cmdline mode and incomplete spokes raises and error
+ if not flags.ksprompt and incompleteSpokes:
errtxt = _("The following mandatory spokes are not completed:") + \
"\n" + "\n".join(spoke.title for spoke in incompleteSpokes)
log.error("CmdlineError: %s", errtxt)
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/c3b7ddedbe2d7a37522ffd2186...
8 years, 2 months