add in primary_variant to do further linking if necessary
This commit is contained in:
parent
d028b28d63
commit
d98c4ee01b
@ -77,12 +77,15 @@
|
|||||||
Azure:
|
Azure:
|
||||||
format: vhd
|
format: vhd
|
||||||
variants: [Base, LVM]
|
variants: [Base, LVM]
|
||||||
|
primary_variant: 'Base'
|
||||||
EC2:
|
EC2:
|
||||||
format: raw
|
format: raw
|
||||||
variants: [Base, LVM]
|
variants: [Base, LVM]
|
||||||
|
primary_variant: 'Base'
|
||||||
GenericCloud:
|
GenericCloud:
|
||||||
format: qcow2
|
format: qcow2
|
||||||
variants: [Base, LVM]
|
variants: [Base, LVM]
|
||||||
|
primary_variant: 'Base'
|
||||||
Container:
|
Container:
|
||||||
format: tar.xz
|
format: tar.xz
|
||||||
variants: [Base, Minimal, UBI]
|
variants: [Base, Minimal, UBI]
|
||||||
|
@ -1366,6 +1366,8 @@ class IsoBuild:
|
|||||||
formattype = extra['format']
|
formattype = extra['format']
|
||||||
|
|
||||||
variants = extra['variants'] if 'variants' in extra.keys() else [None] # need to loop once
|
variants = extra['variants'] if 'variants' in extra.keys() else [None] # need to loop once
|
||||||
|
imagename = name
|
||||||
|
primary_variant = extra['primary_variant'] if 'primary_variant' in extra else None
|
||||||
latest_artifacts = []
|
latest_artifacts = []
|
||||||
|
|
||||||
for variant in variants:
|
for variant in variants:
|
||||||
@ -1398,18 +1400,19 @@ class IsoBuild:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
self.log.info(Color.INFO + 'Attempting to download requested artifacts')
|
self.log.info(Color.INFO + 'Attempting to download requested artifacts')
|
||||||
|
for item in latest_artifacts:
|
||||||
for arch in arches_to_unpack:
|
for arch in arches_to_unpack:
|
||||||
image_arch_dir = os.path.join(
|
image_arch_dir = os.path.join(
|
||||||
self.image_work_dir,
|
self.image_work_dir,
|
||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
|
|
||||||
if arch not in latest_artifacts.keys():
|
if arch not in item.keys():
|
||||||
self.log.warn(Color.WARN + 'Artifact for ' + name +
|
self.log.warn(Color.WARN + 'Artifact for ' + name +
|
||||||
' ' + arch + ' (' + formattype + ') does not exist.')
|
' ' + arch + ' (' + formattype + ') does not exist.')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
source_path = latest_artifacts[arch]
|
source_path = item[arch]
|
||||||
drop_name = source_path.split('/')[-1]
|
drop_name = source_path.split('/')[-1]
|
||||||
checksum_name = drop_name + '.CHECKSUM'
|
checksum_name = drop_name + '.CHECKSUM'
|
||||||
full_drop = '{}/{}'.format(
|
full_drop = '{}/{}'.format(
|
||||||
@ -1470,6 +1473,24 @@ class IsoBuild:
|
|||||||
arch,
|
arch,
|
||||||
formattype
|
formattype
|
||||||
)
|
)
|
||||||
|
# If an image is the primary, we set this.
|
||||||
|
latest_primary_name = '{}/{}-{}-{}.latest.{}.{}'.format(
|
||||||
|
image_arch_dir,
|
||||||
|
self.shortname,
|
||||||
|
self.major_version,
|
||||||
|
imagename,
|
||||||
|
arch,
|
||||||
|
formattype
|
||||||
|
)
|
||||||
|
latest_primary_checksum = '{}/{}-{}-{}.latest.{}.{}.CHECKSUM'.format(
|
||||||
|
image_arch_dir,
|
||||||
|
self.shortname,
|
||||||
|
self.major_version,
|
||||||
|
imagename,
|
||||||
|
arch,
|
||||||
|
formattype
|
||||||
|
)
|
||||||
|
latest_primary_path = latest_name.split('/')[-1]
|
||||||
# For some reason python doesn't have a "yeah just change this
|
# For some reason python doesn't have a "yeah just change this
|
||||||
# link" part of the function
|
# link" part of the function
|
||||||
if os.path.exists(latest_name):
|
if os.path.exists(latest_name):
|
||||||
@ -1488,6 +1509,21 @@ class IsoBuild:
|
|||||||
link.write(checkdata)
|
link.write(checkdata)
|
||||||
link.close()
|
link.close()
|
||||||
|
|
||||||
|
# If this is the primary image, set the appropriate symlink
|
||||||
|
# and checksum
|
||||||
|
if primary_variant and primary_variant in drop_name:
|
||||||
|
self.log.info('This is the primary image, setting link and checksum')
|
||||||
|
if os.path.exists(latest_primary_name):
|
||||||
|
os.remove(latest_primary_name)
|
||||||
|
os.symlink(drop_name, latest_primary_name)
|
||||||
|
shutil.copy2(checksum_drop, latest_primary_checksum)
|
||||||
|
with open(latest_primary_checksum) as link:
|
||||||
|
checkpdata = link.read()
|
||||||
|
checkpdata = checkpdata.replace(drop_name, latest_primary_path)
|
||||||
|
with open(latest_primary_checksum, 'w+') as link:
|
||||||
|
link.write(checkpdata)
|
||||||
|
link.close()
|
||||||
|
|
||||||
self.log.info(Color.INFO + 'Image download phase completed')
|
self.log.info(Color.INFO + 'Image download phase completed')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user