mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 01:22:00 +00:00
Several fixes for imgutil
imgutil had a number of issues contending with a distribution-less image being packed/unpacked.
This commit is contained in:
parent
a5ee3a425f
commit
367854128a
@ -726,7 +726,8 @@ def get_hashes(dirname):
|
||||
fullname = os.path.join(dname, fname)
|
||||
currhash = hashlib.sha512()
|
||||
subname = fullname.replace(dirname + '/', '')
|
||||
hashmap[subname] = get_hash(fullname)
|
||||
if os.path.isfile(fullname):
|
||||
hashmap[subname] = get_hash(fullname)
|
||||
return hashmap
|
||||
|
||||
|
||||
|
@ -354,7 +354,8 @@ def encrypt_image(plainfile, cryptfile, keyfile):
|
||||
|
||||
|
||||
def create_yumconf(sourcedir, addrepos):
|
||||
repodir = tempfile.mkdtemp(prefix='genimage-yumrepos.d-')
|
||||
mkdirp('/run/imgutil/')
|
||||
repodir = tempfile.mkdtemp(prefix='genimage-yumrepos.d-', dir='/run/imgutil/')
|
||||
yumconf = open(os.path.join(repodir, 'repos.repo'), 'w+')
|
||||
if '/' not in sourcedir:
|
||||
sourcedir = os.path.join('/var/lib/confluent/distributions', sourcedir)
|
||||
@ -807,18 +808,24 @@ def fancy_chroot(args, installroot):
|
||||
imgname = os.path.basename(installroot)
|
||||
oshandler = fingerprint_host(args, args.scratchdir)
|
||||
if oshandler:
|
||||
with open(os.path.join(installroot, 'etc/confluentimg.buildinfo')) as binfo:
|
||||
for line in binfo.readlines():
|
||||
if '=' in line:
|
||||
k, v = line.split('=', 1)
|
||||
if k == 'BUILDSRC':
|
||||
dst = os.path.join(installroot, 'run/confluentdistro')
|
||||
dst = os.path.abspath(dst)
|
||||
os.makedirs(dst)
|
||||
_mount(v.strip(), dst, flags=MS_BIND|MS_RDONLY)
|
||||
break
|
||||
else:
|
||||
oshandler = None
|
||||
try:
|
||||
with open(os.path.join(installroot, 'etc/confluentimg.buildinfo')) as binfo:
|
||||
for line in binfo.readlines():
|
||||
if '=' in line:
|
||||
k, v = line.split('=', 1)
|
||||
if k == 'BUILDSRC':
|
||||
dst = os.path.join(installroot, 'run/confluentdistro')
|
||||
dst = os.path.abspath(dst)
|
||||
os.makedirs(dst)
|
||||
try:
|
||||
_mount(v.strip(), dst, flags=MS_BIND|MS_RDONLY)
|
||||
except Exception:
|
||||
oshandler = None
|
||||
break
|
||||
else:
|
||||
oshandler = None
|
||||
except FileNotFoundError:
|
||||
oshandler = None
|
||||
sourceresolv = '/etc/resolv.conf'
|
||||
if os.path.islink(sourceresolv):
|
||||
sourceresolv = os.readlink(sourceresolv)
|
||||
|
Loading…
Reference in New Issue
Block a user