From 4abc3b68a767071c5fc2828e6fc14d44754fd41f Mon Sep 17 00:00:00 2001 From: Francois Blackburn Date: Tue, 16 Apr 2019 18:24:53 -0400 Subject: [PATCH] use the recommended yaml.safe_load function reason: with pyyaml >= 5, the load function without Loader is deprecated. Even if we do not use version 5 for now, we should use good practices. https://pyyaml.org/wiki/PyYAMLDocumentation#loading-yaml https://github.com/yaml/pyyaml/pull/257 --- integration_tests/suite/helpers/base.py | 4 ++-- wazo_auth_keys/main.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_tests/suite/helpers/base.py b/integration_tests/suite/helpers/base.py index 7d748fe..6b9fed5 100644 --- a/integration_tests/suite/helpers/base.py +++ b/integration_tests/suite/helpers/base.py @@ -1,4 +1,4 @@ -# Copyright 2018 The Wazo Authors (see the AUTHORS file) +# Copyright 2018-2019 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import os @@ -109,7 +109,7 @@ def _get_service_config(self, service_name): 'cat', '/var/lib/wazo-auth-keys/{}-key.yml'.format(service_name) ]) - result = yaml.load(output.decode('utf-8')) + result = yaml.safe_load(output.decode('utf-8')) print('_get_service_config sevrice: {}, result: {}'.format(service_name, result)) return result diff --git a/wazo_auth_keys/main.py b/wazo_auth_keys/main.py index ebd1e2c..7d87dc1 100644 --- a/wazo_auth_keys/main.py +++ b/wazo_auth_keys/main.py @@ -1,4 +1,4 @@ -# Copyright 2018 The Wazo Authors (see the AUTHORS file) +# Copyright 2018-2019 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0-or-later import os @@ -68,7 +68,7 @@ def initialize_app(self, argv): self._auth_config = dict(conf['auth']) with open(self.options.config, 'r') as f: - self.services = yaml.load(f) + self.services = yaml.safe_load(f) self.file_manager = FileManager(self, self.options.base_dir)