Changeset 822
- Timestamp:
- Feb 5, 2010, 5:44:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/src/bcfg.py
r816 r822 20 20 21 21 22 currentConfig = None 22 23 23 24 #'dird', 'console', 'filed' or 'stored' … … 198 199 fdcfg.write() 199 200 200 201 def getDirectors(): 202 return [ "bacula-dir" ]; 203 204 def loadDirectorConfig(filename): 205 global currentConfig 206 currentConfig=DirdConfig(filename) 207 currentConfig.read() 208 209 def getDirectorConfig(directorName): 210 global currentConfig 211 return currentConfig 212 213 def 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 201 221 if __name__ == "__main__": 202 222 if len(sys.argv) < 2: … … 205 225 filename=sys.argv[1] 206 226 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 233 231 sys.exit(0)
Note:
See TracChangeset
for help on using the changeset viewer.