mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
instance/check_instance service endpoint added. checks for existing instance (returns json)
This commit is contained in:
parent
a1d5edebe2
commit
2958a21ad1
2 changed files with 10 additions and 0 deletions
|
@ -10,4 +10,6 @@ urlpatterns = [
|
||||||
views.inst_status, name='inst_status'),
|
views.inst_status, name='inst_status'),
|
||||||
url(r'^guess_mac_address/(?P<vname>[\w\-\.]+)/$',
|
url(r'^guess_mac_address/(?P<vname>[\w\-\.]+)/$',
|
||||||
views.guess_mac_address, name='guess_mac_address'),
|
views.guess_mac_address, name='guess_mac_address'),
|
||||||
|
url(r'^check_instance/(?P<vname>[\w\-\.]+)/$',
|
||||||
|
views.check_instance, name='check_instance'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -680,3 +680,11 @@ def guess_mac_address(request, vname):
|
||||||
data['mac'] = line.split(' ')[-1].strip().strip(';')
|
data['mac'] = line.split(' ')[-1].strip().strip(';')
|
||||||
break
|
break
|
||||||
return HttpResponse(json.dumps(data));
|
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));
|
||||||
|
|
Loading…
Reference in a new issue