def find_client(bacula_config_object, guest, director='', **kwargs): '''Will create the client if it wasn't found. You almost certainly need to OVERRIDE THIS to meet your local requirements.''' client = bacula_tools.Client( {bacula_tools.NAME: bacula_tools.hostname_mangler(guest)}).search() if not client[bacula_tools.ID]: # Didn't find the client, so create a new one! client.set(bacula_tools.ADDRESS, guest) bacula_tools.default_jobs(client) bacula_tools.default_director(client, director) return client
def find_client(bacula_config_object, guest, director='', **kwargs): '''Will create the client if it wasn't found. You almost certainly need to OVERRIDE THIS to meet your local requirements.''' client = bacula_tools.Client({ bacula_tools.NAME: bacula_tools.hostname_mangler(guest) }).search() if not client[bacula_tools.ID]: # Didn't find the client, so create a new one! client.set(bacula_tools.ADDRESS, guest) bacula_tools.default_jobs(client) bacula_tools.default_director(client, director) return client
def test_default_jobs(self): bacula_tools.Messages().set_name("Standard") bacula_tools.Pool().set_name("Default") bacula_tools.Storage().set_name("File") bacula_tools.Schedule().set_name("Daily") bacula_tools.Fileset().set_name("FullUnix") bacula_tools.default_jobs(self.client) self.assertEquals(len(self.bc.do_sql("select * from jobs")), 1) self.bc.do_sql("delete from jobs") self.bc.do_sql("delete from storage") self.bc.do_sql("delete from schedules") self.bc.do_sql("delete from pools") self.bc.do_sql("delete from messages") self.bc.do_sql("delete from filesets") return
def test_default_jobs(self): bacula_tools.Messages().set_name('Standard') bacula_tools.Pool().set_name('Default') bacula_tools.Storage().set_name('File') bacula_tools.Schedule().set_name('Daily') bacula_tools.Fileset().set_name('FullUnix') bacula_tools.default_jobs(self.client) self.assertEquals(len(self.bc.do_sql('select * from jobs')), 1) self.bc.do_sql('delete from jobs') self.bc.do_sql('delete from storage') self.bc.do_sql('delete from schedules') self.bc.do_sql('delete from pools') self.bc.do_sql('delete from messages') self.bc.do_sql('delete from filesets') return