[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.
Also copy the s390 configuration files for use with livemedia-creator
Resolves: rhbz#1269213
---
.../templates.d/99-generic/live/config_files/s390/generic.ins | 5 +++++
.../templates.d/99-generic/live/config_files/s390/generic.prm | 1 +
.../99-generic/live/config_files/s390/genericdvd.prm | 1 +
.../templates.d/99-generic/live/config_files/s390/redhat.exec | 9 +++++++++
src/pylorax/ltmpl.py | 11 +++++++++--
5 files changed, 25 insertions(+), 2 deletions(-)
create mode 100644 share/templates.d/99-generic/live/config_files/s390/generic.ins
create mode 100644 share/templates.d/99-generic/live/config_files/s390/generic.prm
create mode 100644 share/templates.d/99-generic/live/config_files/s390/genericdvd.prm
create mode 100644 share/templates.d/99-generic/live/config_files/s390/redhat.exec
diff --git a/share/templates.d/99-generic/live/config_files/s390/generic.ins b/share/templates.d/99-generic/live/config_files/s390/generic.ins
new file mode 100644
index 0000000..756d2ff
--- /dev/null
+++ b/share/templates.d/99-generic/live/config_files/s390/generic.ins
@@ -0,0 +1,5 @@
+* minimal lpar ins file
+images/kernel.img 0x00000000
+images/initrd.img @INITRD_LOAD_ADDRESS@
+images/genericdvd.prm 0x00010480
+images/initrd.addrsize 0x00010408
diff --git a/share/templates.d/99-generic/live/config_files/s390/generic.prm b/share/templates.d/99-generic/live/config_files/s390/generic.prm
new file mode 100644
index 0000000..e1dc397
--- /dev/null
+++ b/share/templates.d/99-generic/live/config_files/s390/generic.prm
@@ -0,0 +1 @@
+ro ramdisk_size=40000 cio_ignore=all,!condev
diff --git a/share/templates.d/99-generic/live/config_files/s390/genericdvd.prm b/share/templates.d/99-generic/live/config_files/s390/genericdvd.prm
new file mode 100644
index 0000000..b5d2731
--- /dev/null
+++ b/share/templates.d/99-generic/live/config_files/s390/genericdvd.prm
@@ -0,0 +1 @@
+ro ramdisk_size=40000 cio_ignore=all,!condev rd.cmdline=ask
diff --git a/share/templates.d/99-generic/live/config_files/s390/redhat.exec b/share/templates.d/99-generic/live/config_files/s390/redhat.exec
new file mode 100644
index 0000000..f1e5931
--- /dev/null
+++ b/share/templates.d/99-generic/live/config_files/s390/redhat.exec
@@ -0,0 +1,9 @@
+/* */
+'CL RDR'
+'PURGE RDR ALL'
+'SPOOL PUNCH * RDR'
+'PUNCH KERNEL IMG A (NOH'
+'PUNCH GENERIC PRM A (NOH'
+'PUNCH INITRD IMG A (NOH'
+'CH RDR ALL KEEP NOHOLD'
+'I 00C'
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/37dc8a65d2a39cb03e53f4a57ecb8...
8 years