Unverified Commit fa720775 authored by Mattia Rizzolo's avatar Mattia Rizzolo
Browse files

use yaml.safe_load() instead of yaml.load()



our yaml is trusted so we don't have any security risk, but this saves a
warning message on run, and it's better anyway since we don't have any
use of the full yaml loader.

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent a97c97ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ import sys
import yaml

with open(os.path.join(os.path.dirname(__file__), 'list.yml')) as f:
    data = yaml.load(f)
    data = yaml.safe_load(f)


class Host:
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import os
import yaml

with open(os.path.join(os.path.dirname(__file__), 'list.yml')) as f:
    data = yaml.load(f)
    data = yaml.safe_load(f)

for host in data:
    print('Host', host['hostname'])
+1 −1
Original line number Diff line number Diff line
@@ -4,6 +4,6 @@ import os
import yaml

with open(os.path.join(os.path.dirname(__file__), 'list.yml')) as f:
    d = yaml.load(f)
    d = yaml.safe_load(f)
    for host in d:
        print(host['hostname'])