Stop using .message attribute on exceptions
It does not exist on Python 3. Converting the exception to string works identically. The validate methods on many phases are simplified by not calling the parent (which does not do anything). Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
b2190c1c3f
commit
4544b454f8
@ -333,7 +333,7 @@ class Compose(kobo.log.LoggingBase):
|
|||||||
try:
|
try:
|
||||||
return (format % args).format(**args)
|
return (format % args).format(**args)
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
raise RuntimeError('Failed to create image name: unknown format element: %s' % err.message)
|
raise RuntimeError('Failed to create image name: unknown format element: %s' % err)
|
||||||
|
|
||||||
def can_fail(self, variant, arch, deliverable):
|
def can_fail(self, variant, arch, deliverable):
|
||||||
"""Figure out if deliverable can fail on variant.arch.
|
"""Figure out if deliverable can fail on variant.arch.
|
||||||
|
@ -54,10 +54,6 @@ class CreaterepoPhase(PhaseBase):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
|
||||||
super(CreaterepoPhase, self).validate()
|
|
||||||
except ValueError as exc:
|
|
||||||
errors = exc.message.split('\n')
|
|
||||||
|
|
||||||
if not self.compose.old_composes and self.compose.conf.get('createrepo_deltas'):
|
if not self.compose.old_composes and self.compose.conf.get('createrepo_deltas'):
|
||||||
errors.append('Can not generate deltas without old compose')
|
errors.append('Can not generate deltas without old compose')
|
||||||
|
@ -69,10 +69,6 @@ class GatherPhase(PhaseBase):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
|
||||||
super(GatherPhase, self).validate()
|
|
||||||
except ValueError as exc:
|
|
||||||
errors = exc.message.split('\n')
|
|
||||||
|
|
||||||
if not Modulemd:
|
if not Modulemd:
|
||||||
# Modules are not supported, check if we need them
|
# Modules are not supported, check if we need them
|
||||||
@ -306,7 +302,7 @@ def _prepare_variant_as_lookaside(compose):
|
|||||||
try:
|
try:
|
||||||
graph.add_edge(variant, lookaside_variant)
|
graph.add_edge(variant, lookaside_variant)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise ValueError("There is a bad configuration in 'variant_as_lookaside': %s" % e.message)
|
raise ValueError("There is a bad configuration in 'variant_as_lookaside': %s" % e)
|
||||||
|
|
||||||
variant_processing_order = reversed(graph.prune_graph())
|
variant_processing_order = reversed(graph.prune_graph())
|
||||||
return list(variant_processing_order)
|
return list(variant_processing_order)
|
||||||
|
@ -35,10 +35,6 @@ class ImageChecksumPhase(PhaseBase):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
|
||||||
super(ImageChecksumPhase, self).validate()
|
|
||||||
except ValueError as exc:
|
|
||||||
errors = exc.message.split('\n')
|
|
||||||
|
|
||||||
if self.one_file and len(self.checksums) != 1:
|
if self.one_file and len(self.checksums) != 1:
|
||||||
errors.append(MULTIPLE_CHECKSUMS_ERROR)
|
errors.append(MULTIPLE_CHECKSUMS_ERROR)
|
||||||
|
@ -23,10 +23,6 @@ class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
|
||||||
super(OstreeInstallerPhase, self).validate()
|
|
||||||
except ValueError as exc:
|
|
||||||
errors = exc.message.split('\n')
|
|
||||||
|
|
||||||
if not self.compose.conf['ostree_installer_overwrite'] and not self.bi._skipped:
|
if not self.compose.conf['ostree_installer_overwrite'] and not self.bi._skipped:
|
||||||
for variant in self.compose.get_variants():
|
for variant in self.compose.get_variants():
|
||||||
|
@ -375,7 +375,7 @@ def get_volid(compose, arch, variant=None, escape_spaces=False, disc_type=False)
|
|||||||
base_product_version=base_product_version)
|
base_product_version=base_product_version)
|
||||||
volid = (i % args).format(**args)
|
volid = (i % args).format(**args)
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
raise RuntimeError('Failed to create volume id: unknown format element: %s' % err.message)
|
raise RuntimeError('Failed to create volume id: unknown format element: %s' % err)
|
||||||
volid = _apply_substitutions(compose, volid)
|
volid = _apply_substitutions(compose, volid)
|
||||||
if len(volid) <= 32:
|
if len(volid) <= 32:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user