Copying same file shouldn't crash (#1269213)

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
(cherry picked from commit 701ab02619)
This commit is contained in:
Brian C. Lane 2016-03-30 13:57:10 -07:00
parent 424fdd5cda
commit 391f1a7b57
5 changed files with 25 additions and 2 deletions

View File

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

View File

@ -0,0 +1 @@
ro ramdisk_size=40000 cio_ignore=all,!condev

View File

@ -0,0 +1 @@
ro ramdisk_size=40000 cio_ignore=all,!condev rd.cmdline=ask

View File

@ -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'

View File

@ -26,6 +26,7 @@ logger = logging.getLogger("pylorax.ltmpl")
import os, re, glob, shlex, fnmatch import os, re, glob, shlex, fnmatch
from os.path import basename, isdir from os.path import basename, isdir
from subprocess import CalledProcessError from subprocess import CalledProcessError
import shutil
from sysutils import joinpaths, cpfile, mvfile, replace, remove from sysutils import joinpaths, cpfile, mvfile, replace, remove
from yumhelper import * # Lorax*Callback classes from yumhelper import * # Lorax*Callback classes
@ -231,7 +232,10 @@ class LoraxTemplateRunner(object):
install /usr/share/myconfig/grub.conf.in /boot/grub.conf install /usr/share/myconfig/grub.conf.in /boot/grub.conf
''' '''
for src in rglob(self._in(srcglob), fatal=True): 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, srcdir, destfile): def installimg(self, srcdir, destfile):
''' '''
@ -362,7 +366,10 @@ class LoraxTemplateRunner(object):
If DEST doesn't exist, SRC will be copied to a file with If DEST doesn't exist, SRC will be copied to a file with
that name, if the path leading to it exists. 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): def move(self, src, dest):
''' '''