hotfix: add returncode checks for operator

This commit is contained in:
Louis Abel 2023-07-13 13:29:54 -07:00
parent 32f0c3520c
commit bcea55337f
Signed by: label
GPG Key ID: 3331F061D1D9990E
3 changed files with 16 additions and 3 deletions

View File

@ -80,7 +80,10 @@ class Import:
f"'%_topdir {local_repo_path}'"
]
command_to_send = ' '.join(command_to_send)
processor.run_proc_no_output_shell(command_to_send)
returned = processor.run_proc_no_output_shell(command_to_send)
if returned != 0:
rpmerr = returned.stderr
raise err.RpmOpenError(f'This package could not be unpacked:\n\n{rpmerr}')
@staticmethod
def pack_srpm(srpm_dir, spec_file, dist_tag):
@ -103,6 +106,9 @@ class Import:
]
command_to_send = ' '.join(command_to_send)
returned = processor.run_proc_no_output_shell(command_to_send)
if returned != 0:
rpmerr = returned.stderr
raise err.RpmBuildError(f'There was error packing the rpm:\n\n{rpmerr}')
wrote_regex = r'Wrote:\s+(.*\.rpm)'
regex_search = re.search(wrote_regex, returned.stdout, re.MULTILINE)
if regex_search:

View File

@ -96,6 +96,7 @@ class ErrorConstants:
RPM_ERR_OPEN = 9400
RPM_ERR_SIG = 9401
RPM_ERR_INFO = 9402
RPM_ERR_BUILD = 9403
# pylint: disable=too-few-public-methods
class MockConstants:

View File

@ -31,6 +31,7 @@ __all__ = [
'RpmOpenError',
'RpmSigError',
'RpmInfoError',
'RpmBuildError',
]
@ -170,7 +171,12 @@ class RpmSigError(GenericError):
class RpmInfoError(GenericError):
"""
There was an issue opening the RPM because the signature could not be
verified
There was an issue opening the RPM because the RPM is not valid.
"""
fault_code = errconst.RPM_ERR_INFO
class RpmBuildError(GenericError):
"""
There was an issue building or packing the RPM.
"""
fault_code = errconst.RPM_ERR_BUILD