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:
		
							parent
							
								
									a1d5edebe2
								
							
						
					
					
						commit
						2958a21ad1
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		|  | @ -10,4 +10,6 @@ urlpatterns = [ | |||
|         views.inst_status, name='inst_status'), | ||||
|     url(r'^guess_mac_address/(?P<vname>[\w\-\.]+)/$', | ||||
|         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(';') | ||||
|                 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)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue