Verify profile is valid when creating VM

This commit is contained in:
Joshua Boniface 2020-01-07 10:49:00 -05:00
parent e2b9ce2a70
commit 0fca10de4a
1 changed files with 5 additions and 0 deletions

View File

@ -5372,6 +5372,11 @@ class API_Provisioner_Create_Root(Resource):
type: object
id: Message
"""
# Verify that the profile is valid
_list, code = api_provisioner.list_profile(reqargs.get('profile', None), is_fuzzy=False)
if code != 200:
return { 'message': 'Profile "{}" is not valid.'.format(reqargs.get('profile')) }, 400
task = create_vm.delay(
reqargs.get('name', None),
reqargs.get('profile', None)