Ignore:
Timestamp:
Feb 12, 2010, 2:50:32 PM (15 years ago)
Author:
slederer
Message:

Funktionen für SOAP-API hinzugefügt, Entwurf für WSDL-File

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/src/bcfg.py

    r822 r823  
    212212
    213213def getClients(directorName):
     214    return getResources(directorName,"Client")
     215
     216def getResources(directorName,resType):
    214217    dirdcfg=getDirectorConfig(directorName)
    215     clients=dirdcfg.getRoot().getByType("Client",1)
     218    resources=dirdcfg.getRoot().getByType(resType,1)
    216219    result=[]
    217     for c in clients:
    218         result.append((c.id,c.getName()))
     220    for r in resources:
     221        result.append((r.id,r.getName()))
    219222    return result
     223
     224def getResourceById(directorName,resId):
     225    dirdcfg=getDirectorConfig(directorName)
     226    return dirdcfg.getRoot().getById(resId)   
     227
     228def getResourceByName(directorName,resType,name):
     229    dirdcfg=getDirectorConfig(directorName)
     230    return dirdcfg.getRoot().getByName(name,resType)[0]   
     231
    220232
    221233if __name__ == "__main__":
     
    228240
    229241    print getClients("bacula-dir")
    230 
     242    print getResources("bacula-dir","Client")
     243    print getResources("bacula-dir","Job")
     244    print getResourceById("bacula-dir",100)
     245    print getResourceByName("Bacula-dir","Client","cryptoserver-fd")
    231246    sys.exit(0)
Note: See TracChangeset for help on using the changeset viewer.