[spp] [PATCH 1/2] controller: fix warning for pyyaml loader

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed May 8 03:59:00 CEST 2019


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

Using `yaml.load` without loader has deprecated. This update is to add
loader `FullLoader` to the method call for fixing warning.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/controller/commands/topo.py | 2 +-
 src/controller/shell.py         | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/controller/commands/topo.py b/src/controller/commands/topo.py
index e8afa4a..3b24c1a 100644
--- a/src/controller/commands/topo.py
+++ b/src/controller/commands/topo.py
@@ -375,7 +375,7 @@ class SppTopo(object):
         stat = stat.replace("\x00", "")
         stat = stat.replace("'", "")
 
-        stat_obj = yaml.load(stat)
+        stat_obj = yaml.load(stat, Loader=yaml.FullLoader)
         res = {}
         res['sec_id'] = sec_id
         res['status'] = stat_obj['status']
diff --git a/src/controller/shell.py b/src/controller/shell.py
index e3f1ff8..057f70a 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -28,7 +28,8 @@ class Shell(cmd.Cmd, object):
     try:
         config_file = "{}/config/default.yml".format(
                 os.path.dirname(__file__))
-        cli_config = yaml.load(open(config_file))
+        cli_config = yaml.load(open(config_file),
+                Loader=yaml.FullLoader)
     except IOError as e:
         print('Error: no config file found!')
         print(e)
-- 
2.17.1



More information about the spp mailing list