diff --git a/client-cli/pvc.py b/client-cli/pvc.py index b208d712..50a668ea 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -2759,9 +2759,14 @@ def provisioner_userdata_add(name, filename): Add a new userdata document NAME from file FILENAME. """ - # Open the XML file + # Open the YAML file userdata = filename.read() filename.close() + try: + yaml.load(userdata, Loader=yaml.FullLoader) + except Exception as e: + click.echo("Error: Userdata document is malformed") + cleanup(False, e) params = dict() params['name'] = name @@ -2833,6 +2838,12 @@ def provisioner_userdata_modify(name, filename, editor): userdata = filename.read().strip() filename.close() + try: + yaml.load(userdata, Loader=yaml.FullLoader) + except Exception as e: + click.echo("Error: Userdata document is malformed") + cleanup(False, e) + params = dict() params['data'] = userdata