yaml.load: Set Loader to avoid deprecation warning

Since PyYAML 5.1, yaml.load without specifying the Loader option is
deprecated and shows the following warning.

YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe.
Please read https://msg.pyyaml.org/load for full details.

This change adds the Loader option to get rid of that warning message.

Change-Id: Ib785e9a11b5de5b0317959efc1c5a61d63175d59
This commit is contained in:
Takashi Kajinami 2021-07-22 22:11:06 +09:00
parent 8e2f503244
commit b6f38000d2
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ def get_dpdk_nics_mapping(module, dpdk_mapping_file, mac):
err = "Unable to determine DPDK NIC's details"
module.fail_json(msg=err)
else:
dpdk_nics_map = yaml.load(str(result[1]))
dpdk_nics_map = yaml.load(str(result[1]), Loader=yaml.SafeLoader)
for dpdk_nic_map in dpdk_nics_map:
if dpdk_nic_map['mac_address'] == mac:
return dpdk_nic_map