Browse Source

Fix loading yaml file warning in Python 3

Change-Id: I226850967632b87b5a84c053ea6d6d7ad081f9ab
Dobroslaw Zybort 7 months ago
parent
commit
dca2fa82ef
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      monasca_notification/config.py

+ 2
- 1
monasca_notification/config.py View File

@@ -60,5 +60,6 @@ def parse_args(argv, no_yaml=False):
60 60
 def set_from_yaml():
61 61
     if CONF.yaml_config:
62 62
         LOG.info('Detected usage of deprecated YAML configuration')
63
-        yaml_cfg = yaml.safe_load(open(CONF.yaml_config, 'rb'))
63
+        with open(CONF.yaml_config, 'rb') as ycf:
64
+            yaml_cfg = yaml.safe_load(ycf.read())
64 65
         conf.load_from_yaml(yaml_cfg)

Loading…
Cancel
Save