Changeset 822


Ignore:
Timestamp:
Feb 5, 2010, 5:44:06 PM (15 years ago)
Author:
slederer
Message:

Vorbereitende Wrapper-Funktionen für SOAP-Schnittstelle

File:
1 edited

Legend:

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

    r816 r822  
    2020
    2121
     22currentConfig = None
    2223
    2324#'dird', 'console', 'filed' or 'stored'
     
    198199            fdcfg.write()
    199200
    200  
     201def getDirectors():
     202    return [ "bacula-dir" ];
     203
     204def loadDirectorConfig(filename):
     205    global currentConfig
     206    currentConfig=DirdConfig(filename)
     207    currentConfig.read()
     208
     209def getDirectorConfig(directorName):
     210    global currentConfig
     211    return currentConfig
     212
     213def getClients(directorName):
     214    dirdcfg=getDirectorConfig(directorName)
     215    clients=dirdcfg.getRoot().getByType("Client",1)
     216    result=[]
     217    for c in clients:
     218        result.append((c.id,c.getName()))
     219    return result
     220
    201221if __name__ == "__main__":
    202222    if len(sys.argv) < 2:
     
    205225        filename=sys.argv[1]   
    206226
    207     dirdcfg = DirdConfig(filename)
    208     dirdcfg.read()
    209 
    210     root=dirdcfg.getRoot()
    211 
    212     job=resource.Job(1,"Job")
    213     job.setDefaults("test2-job","test2","testdefs","Full Set")
    214 
    215     root.add_item(job)
    216 
    217     pwd=genpasswd()
    218     newclient=resource.Client(1,"Client")
    219     newclient.setDefaults("test-fd","testclient","MyCatalog",pwd)
    220     root.add_item(newclient)
    221 
    222     dirdcfg.write("test.conf.out")
    223 
    224     fdcfg=FiledConfig("test-fd.conf")
    225     fdcfg.setDefaults("bacula-dird",pwd,"test-fd")
    226     fdcfg.write()
    227 
    228 
    229     createClientConfig(dirdcfg,"gaffel-fd")
    230     createClientConfig(dirdcfg,"test-fd")
    231 
    232     createAllClientConfigs(dirdcfg)
     227    loadDirectorConfig(filename)
     228
     229    print getClients("bacula-dir")
     230
    233231    sys.exit(0)
Note: See TracChangeset for help on using the changeset viewer.