Ejemplo n.º 1
0
def servers_view(request):
    return {"layout": site_layout(),
            "config_sidebar_head" : config_sidebar_head(),
            "config_sidebar_body" : config_sidebar_body(),
            "ObjectList" : getServerDict(),
            "ObjectName" : "server",
            "ObjectClassName" : "server",
            "AddURL" : "/server_add",
            "ObjectURLCallback" : _objectEditUrl,
            "page_title": "Servers"}
Ejemplo n.º 2
0
def _objectGenertorDelete(objectGenerator,name,objectName,path):
    serversUsing = {}
    servers = getServerDict()
    for serverName in servers.keys():
        for section in servers[serverName]:
            
            #Try to see if we have a section at all
            try:
                if servers[serverName][section][objectGenerator.lower()] == name:
                    if not serverName in serversUsing.keys():
                        serversUsing[serverName] = []
                    serversUsing[serverName].append(section)
            except:
                pass
    #formatting
    for serverName in serversUsing.keys():
        serversUsing[serverName] = ",".join(serversUsing[serverName])
        
    if len(serversUsing.keys()) == 0:
        return True
    returnString =""
    for server in serversUsing:
        returnString = returnString +  server + " in: " + serversUsing[serverName] + ". "
    return objectGenerator + " is being used in these servers - " + returnString
Ejemplo n.º 3
0
def sendOckleCommand(request):
    ''' The function explicitly lists the commands we accept from the browser and then pass to Ockle as real commands
    '''
    command = request.json_body["command"]
    
    dataDict = {}
    try:
        dataDict = request.json_body["dataDict"]
    except:
        pass
    
    print command
    if command == "restart":
        restartOckle()
    
    if command == "checkExistingPDUs":
        try:
            return {"reply" : dataDict["name"] in getPDUDict()}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingTesters":
        try:
            return {"reply" : dataDict["name"] in getTesterDict()}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerOutlets":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerOutlets(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerTests":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerTesters(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerControls":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerControls(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
        
    if command == "checkExistingServers":
        try:
            return {"reply" : dataDict["name"] in getServerDict()}            
        except:
            return {"reply" : "Error"}
            
    if command == "deleteObject":
        return deleteObject(dataDict)
    
    if command == "setServer":
        return setServer(dataDict)
    
    if command == "switchOutlet":
        return switchOutlet(dataDict)
        
    if command == "switchControl":
        return switchControl(dataDict)
    
    if command == "runTest":
        return runTest(dataDict)
    
    if command == "getAutoControlStatus":
        return getAutoControlStatus()
    
    if command == "setAutoControlStatus":
        return setAutoControlStatus(dataDict)
    
    if command == "switchNetwork":
        return switchNetwork(dataDict)
        
    return dataDict