Validate provisioner userdata with SafeLoader
Given the issues with FullLoader and its eventual deprecation, just use SafeLoader instead. Any well-formatted Userdata document should conform.
This commit is contained in:
parent
3705daff43
commit
37c3b4ef80
|
@ -3320,7 +3320,7 @@ def provisioner_userdata_add(name, filename):
|
||||||
userdata = filename.read()
|
userdata = filename.read()
|
||||||
filename.close()
|
filename.close()
|
||||||
try:
|
try:
|
||||||
yaml.load(userdata, Loader=yaml.FullLoader)
|
yaml.load(userdata, Loader=yaml.SafeLoader)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo("Error: Userdata document is malformed")
|
click.echo("Error: Userdata document is malformed")
|
||||||
cleanup(False, e)
|
cleanup(False, e)
|
||||||
|
@ -3397,7 +3397,7 @@ def provisioner_userdata_modify(name, filename, editor):
|
||||||
filename.close()
|
filename.close()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yaml.load(userdata, Loader=yaml.FullLoader)
|
yaml.load(userdata, Loader=yaml.SafeLoader)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo("Error: Userdata document is malformed")
|
click.echo("Error: Userdata document is malformed")
|
||||||
cleanup(False, e)
|
cleanup(False, e)
|
||||||
|
|
Loading…
Reference in New Issue