Fix missing YAML load

This commit is contained in:
Joshua Boniface 2023-08-27 11:35:21 -04:00
parent 1e083d7652
commit 33205273dc
1 changed files with 4 additions and 2 deletions

View File

@ -27,6 +27,8 @@ from os import environ, makedirs, path
from pkg_resources import get_distribution from pkg_resources import get_distribution
from lxml.etree import fromstring, tostring from lxml.etree import fromstring, tostring
from re import sub from re import sub
from yaml import load as yload
from yaml import SafeLoader as SafeYAMLLoader
from pvc.cli.helpers import * from pvc.cli.helpers import *
from pvc.cli.waiters import * from pvc.cli.waiters import *
@ -4510,7 +4512,7 @@ def cli_provisioner_userdata_add(name, filename):
userdata = filename.read() userdata = filename.read()
filename.close() filename.close()
try: try:
yaml.load(userdata, Loader=yaml.SafeLoader) yload(userdata, Loader=SafeYAMLLoader)
except Exception as e: except Exception as e:
echo("Error: Userdata document is malformed") echo("Error: Userdata document is malformed")
cleanup(False, e) cleanup(False, e)
@ -4599,7 +4601,7 @@ def cli_provisioner_userdata_modify(name, filename, editor):
filename.close() filename.close()
try: try:
yaml.load(userdata, Loader=yaml.SafeLoader) yload(userdata, Loader=SafeYAMLLoader)
except Exception as e: except Exception as e:
echo("Error: Userdata document is malformed") echo("Error: Userdata document is malformed")
cleanup(False, e) cleanup(False, e)