From 64f189becffa630a245f502e5704074d22636def Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Tue, 14 Jul 2020 21:41:55 +0300 Subject: [PATCH] Adapt for python-yaml 5.2 (RB#10720) ``` abf/console/misc.py:239: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. yaml_data = yaml.load(fd) ``` https://bugzilla.rosalinux.ru/show_bug.cgi?id=10720#c4 --- abf/console/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/abf/console/misc.py b/abf/console/misc.py index c5ac107..cbb1fea 100644 --- a/abf/console/misc.py +++ b/abf/console/misc.py @@ -236,7 +236,7 @@ def find_spec_problems(exit_on_error=True, strict=False, auto_remove=False): if os.path.isfile(yaml_path): with open(yaml_path, 'r') as fd: try: - yaml_data = yaml.load(fd) + yaml_data = yaml.safe_load(fd) except yaml.scanner.ScannerError as ex: log.error(_('Invalid yml file %(file)s!\nProblem in line %(line)d column %(col)d: %(exception)s') % {'file': yaml_path, 'line': ex.problem_mark.line, 'col': ex.problem_mark.column, 'exception': ex.problem}) except yaml.composer.ComposerError as ex: @@ -463,7 +463,7 @@ def is_text_file(path): def fetch_files(models, yaml_path, file_names=None): with open(yaml_path, 'r') as fd: - yaml_data = yaml.load(fd) + yaml_data = yaml.safe_load(fd) if not yaml_data or not 'sources' in yaml_data: log.error(_("Incorrect .abf.yml file: no 'sources' key.")) exit(1) @@ -504,7 +504,7 @@ def upload_files(models, min_size, path=None, remove_files=True, upload_all=Fals if os.path.isfile(yaml_path): with open(yaml_path, 'r') as fd: try: - yaml_data = yaml.load(fd) + yaml_data = yaml.safe_load(fd) except (yaml.composer.ComposerError, yaml.scanner.ScannerError) : log.error(_('Could not parse .abf.yml file. It seems to be corrupted and will be rewritten.')) yaml_file_changed = True