1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

instance/check_instance service endpoint added. checks for existing instance (returns json)

This commit is contained in:
Jan Krcmar 2016-02-11 14:37:26 +01:00
parent a1d5edebe2
commit 2958a21ad1
2 changed files with 10 additions and 0 deletions

View file

@ -680,3 +680,11 @@ def guess_mac_address(request, vname):
data['mac'] = line.split(' ')[-1].strip().strip(';')
break
return HttpResponse(json.dumps(data));
@login_required
def check_instance(request, vname):
check_instance = Instance.objects.filter(name=vname)
data = { 'vname': vname, 'exists': False }
if check_instance:
data['exists'] = True
return HttpResponse(json.dumps(data));