Ejemplo n.º 1
0
 def isActive(self):
     try:
         status = manager.check_server_status(self.ip_address, self.port_number)
         if status is False and manager.get_os() is not "Win":
             status = "node" in os.popen("lsof -i :"+ self.port_number).read()
         return status
     except Exception as e:
         print "Is Active - Exception thrown: " + str(e)
         return False
Ejemplo n.º 2
0
Archivo: views.py Proyecto: malazay/ASM
def stop_server(request, server_id):
    server = get_object_or_404(Server, pk=server_id)
    server.server_status = server.isActive()
    try:
        if server.is_iOS:
            kill_webkit_proxy(server.webkit_executable.port)
        time.sleep(3)
        pass
    except Exception as e:
        print "Error: " + str(e)
    if get_os() is "Win":
        win_kill_process_by_port(server.port_number)
    else:
        stop_appium_server(server.port_number)
    return HttpResponseRedirect(request.META.get('HTTP_REFERER'))