Changeset 823 for vanHelsing/trunk/src


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

Location:
vanHelsing/trunk/src
Files:
2 added
2 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)
  • vanHelsing/trunk/src/resource.py

    r816 r823  
    8383        return None
    8484
    85     def getByName(self,name):
     85    def getByName(self,name,type=None):
    8686        result=[]
    87         if self.getName()==name:
     87        if self.getName()==name and (type==None or self.type==type):
    8888            result.append(self)
    8989        for i in self.items:
    90             r=i.getByName(name)
     90            r=i.getByName(name,type)
    9191            if len(r)!=0:
    9292                for a in r:
Note: See TracChangeset for help on using the changeset viewer.