Commit 82d3852c authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: test: Avoid YAMLLoadWarning warning

Currently on every test yaml.load issues a warning that using it without
explicitly specifying loader is deprecated, for example:

    test_enb_conf (testTDD.TestENBParameters) .../slapos/software/ors-amarisoft/test/test.py:29: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

-> Fix the warning by using appropriate loader explicitly.

Use FullLoader since msg.pyyaml.org/load describes it as

   Loads the full YAML language. Avoids arbitrary code execution.
   This is currently (PyYAML 5.1+) the default loader called by yaml.load(input) (after issuing the warning).

i.e. we get support for full YAML feature set, do not get code execution and
make sure that the behaviour stays exactly the same as before, but without the
warning.

/cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
/proposed-for-review-on nexedi/slapos!1526
/reviewed-by TrustMe
parent ff40ed40
......@@ -26,4 +26,4 @@ import yaml
def yaml_load(path):
with open(path, 'r') as f:
data = f.read()
return yaml.load(data)
return yaml.load(data, loader=yaml.FullLoader)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment