def install(self, force=False): if not force and self.is_installed(): return jujuresources.install(self.resources['zookeeper'], destination=self.dist_config.path('zookeeper'), skip_top_level=True) self.dist_config.add_users() utils.disable_firewall() self.dist_config.add_dirs() self.dist_config.add_packages() self.setup_zookeeper_config() self.configure_zookeeper() unitdata.kv().set('zookeeper.installed', True)
def test_disable_firewall_on_error(self): with mock.patch.object(utils, 'check_call') as check_call: try: with utils.disable_firewall(): check_call.assert_called_once_with(['ufw', 'disable']) raise TestError() except TestError: check_call.assert_called_with(['ufw', 'enable'])
def install_base_packages(self): with utils.disable_firewall(): self.install_java() self.install_hadoop()
def test_disable_firewall(self): with mock.patch.object(utils, 'check_call') as check_call: with utils.disable_firewall(): check_call.assert_called_once_with(['ufw', 'disable']) check_call.assert_called_with(['ufw', 'enable'])