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_two_parts(self): self.assertEquals(bacula_tools.hostname_mangler("www.here"), "www.here") return
def test_four_parts(self): self.assertEquals(bacula_tools.hostname_mangler("www.here.example.net"), "www.here") return
def test_exmample_io(self): self.assertEquals(bacula_tools.hostname_mangler("www.example.io"), "www") return
def test_two_parts(self): self.assertEquals(bacula_tools.hostname_mangler('www.here'), 'www.here') return
def test_four_parts(self): self.assertEquals( bacula_tools.hostname_mangler('www.here.example.net'), 'www.here') return
def test_exmample_io(self): self.assertEquals(bacula_tools.hostname_mangler('www.example.io'), 'www') return