diff options
author | Milan Verespej <m.verespej@partner.samsung.com> | 2019-05-23 14:21:19 +0200 |
---|---|---|
committer | Milan Verespej <m.verespej@partner.samsung.com> | 2019-06-04 15:46:42 +0200 |
commit | 455be472dfdd4b3c9d2e1cc3c4962115760383f4 (patch) | |
tree | 076dc7f5d741d3685c6269f8ac6a5b0f92a2c53b /build/download/rpm_packages.py | |
parent | df7d7cc1294c6ea1fcab2ed4ac2ee7c375b29651 (diff) |
Add base download script
This script is supposed to be used for convenience when
downloading data from multiple lists at once.
Issue-ID: OOM-1803
Change-Id: I4031ed3650f7880883e299b43c79e6bfd08c886c
Signed-off-by: Milan Verespej <m.verespej@partner.samsung.com>
Diffstat (limited to 'build/download/rpm_packages.py')
-rwxr-xr-x | build/download/rpm_packages.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/build/download/rpm_packages.py b/build/download/rpm_packages.py index 7f9700a3..732af0ea 100755 --- a/build/download/rpm_packages.py +++ b/build/download/rpm_packages.py @@ -33,7 +33,7 @@ log = logging.getLogger(name=__name__) def download(rpm_list, dst_dir): if not base.check_tool('yumdownloader'): log.error('ERROR: yumdownloader is not installed') - return 1 + raise RuntimeError('yumdownloader missing') rpm_set = base.load_list(rpm_list) @@ -41,11 +41,10 @@ def download(rpm_list, dst_dir): log.info('Running command: {}'.format(command)) try: subprocess.check_call(command.split()) - log.info('Downloaded') except subprocess.CalledProcessError as err: - log.error(err.output) - return err.returncode - + log.exception(err.output) + raise err + log.info('Downloaded') def run_cli(): @@ -59,7 +58,11 @@ def run_cli(): logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(message)s') - sys.exit(download(args.rpm_list, args.output_dir)) + try: + download(args.rpm_list, args.output_dir) + except (subprocess.CalledProcessError, RuntimeError): + sys.exit(1) + if __name__ == '__main__': |