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...