2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 02:52:07 +00:00

Fix suse imgutil build function

This commit is contained in:
Jarrod Johnson 2021-08-27 09:03:35 -04:00
parent e35ce77bc7
commit ce98ff6b3d

View File

@ -414,8 +414,10 @@ class OsHandler(object):
class SuseHandler(OsHandler):
def __init__(self, name, version, arch, args):
if not version.startswith(b'15.'):
raise Exception('Unsupported Suse version {}'.format(version.decode('utf8')))
if not isinstance(version, str):
version = version.decade('utf8')
if not version.startswith('15.'):
raise Exception('Unsupported Suse version {}'.format(version))
self.oscategory = 'suse15'
super().__init__(name, version, arch, args)
self.zyppargs = []
@ -443,11 +445,18 @@ class SuseHandler(OsHandler):
mkdirp(targzypp)
shutil.copytree(
'/etc/zypp/repos.d/', os.path.join(targzypp, 'repos.d'))
idx = 1
for source in self.sources:
subprocess.check_call(['zypper', '-R', self.targpath, 'ar', source])
if not source:
continue
subprocess.check_call(['zypper', '-R', self.targpath, 'ar', source, 'source-{}'.format(idx)])
idx += 1
for source in self.addrepos.split(','):
if not source:
continue
source = 'file://' + source
subprocess.check_call(['zypper', '-R', self.targpath, 'ar', source])
subprocess.check_call(['zypper', '-R', self.targpath, 'ar', source, 'source-{}'.format(idx)])
idx += 1
mydir = get_mydir(self.oscategory)
mkdirp(os.path.join(self.targpath, 'usr/lib/dracut/modules.d'))
mkdirp(os.path.join(self.targpath, 'etc/dracut.conf.d'))