def test_register_configs_post_install(self, renderer, swift, rsync, server, bind_context, worker_context): swift.return_value = 'swift_context' rsync.return_value = 'rsync_context' server.return_value = 'swift_server_context' bind_context.return_value = 'bind_host_context' worker_context.return_value = 'worker_context' self.get_os_codename_package.return_value = 'grizzly' configs = MagicMock() configs.register = MagicMock() renderer.return_value = configs swift_utils.register_configs() renderer.assert_called_with(templates_dir=swift_utils.TEMPLATES, openstack_release='grizzly') ex = [ call('/etc/swift/swift.conf', ['swift_server_context']), call('/etc/rsync-juju.d/050-swift-storage.conf', ['rsync_context', 'swift_context']), call('/etc/swift/account-server.conf', ['swift_context', 'bind_host_context', 'worker_context']), call('/etc/swift/object-server.conf', ['swift_context', 'bind_host_context', 'worker_context']), call('/etc/swift/container-server.conf', ['swift_context', 'bind_host_context', 'worker_context']) ] self.assertEqual(ex, configs.register.call_args_list)
def test_register_configs_post_install(self, renderer, swift, rsync, server, bind_context, worker_context): swift.return_value = 'swift_context' rsync.return_value = 'rsync_context' server.return_value = 'swift_server_context' bind_context.return_value = 'bind_host_context' worker_context.return_value = 'worker_context' self.vaultlocker.VaultKVContext.return_value = 'vl_context' self.get_os_codename_package.return_value = 'grizzly' configs = MagicMock() configs.register = MagicMock() renderer.return_value = configs swift_utils.register_configs() renderer.assert_called_with(templates_dir=swift_utils.TEMPLATES, openstack_release='grizzly') ex = [ call('/etc/swift/swift.conf', ['swift_server_context']), call('/etc/rsync-juju.d/050-swift-storage.conf', ['rsync_context', 'swift_context']), call('/etc/swift/account-server.conf', ['swift_context', 'bind_host_context', 'worker_context', 'vl_context']), call('/etc/swift/object-server.conf', ['swift_context', 'bind_host_context', 'worker_context', 'vl_context']), call('/etc/swift/container-server.conf', ['swift_context', 'bind_host_context', 'worker_context', 'vl_context']) ] self.assertEqual(ex, configs.register.call_args_list)
def test_register_configs_post_install(self, renderer, swift, rsync, server, bind_context, worker_context, filter_installed_packages, enable_replication, vaultlocker_installed): vaultlocker_installed.return_value = True enable_replication.return_value = True filter_installed_packages.return_value = [] swift.return_value = 'swift_context' rsync.return_value = 'rsync_context' server.return_value = 'swift_server_context' bind_context.return_value = 'bind_host_context' worker_context.return_value = 'worker_context' self.vaultlocker.VaultKVContext.return_value = 'vl_context' self.get_os_codename_package.return_value = 'grizzly' configs = MagicMock() configs.register = MagicMock() renderer.return_value = configs swift_utils.register_configs() renderer.assert_called_with(templates_dir=swift_utils.TEMPLATES, openstack_release='grizzly') ex = [ call('/etc/swift/swift.conf', ['swift_server_context']), call('/etc/rsync-juju.d/050-swift-storage.conf', ['rsync_context', 'swift_context']), call('/etc/swift/account-server.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]), call('/etc/swift/container-server.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]), call('/etc/swift/object-server.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]), call('/etc/swift/account-server/account-server-replicator.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]), call( '/etc/swift/container-server/container-server-replicator.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]), call('/etc/swift/object-server/object-server-replicator.conf', [ 'swift_context', 'bind_host_context', 'worker_context', 'vl_context' ]) ] self.assertEqual(sorted(ex), sorted(configs.register.call_args_list))
def test_register_configs_pre_install(self, renderer): self.get_os_codename_package.return_value = None swift_utils.register_configs() renderer.assert_called_with(templates_dir=swift_utils.TEMPLATES, openstack_release='essex')
def test_register_configs_pre_install(self, renderer): self.get_os_codename_package.return_value = None swift_utils.register_configs() renderer.assert_called_with(templates_dir=swift_utils.TEMPLATES, openstack_release='essex')
set_unit_upgrading, get_os_codename_install_source, ) from charmhelpers.contrib.network.ip import ( get_relation_ip, ) from charmhelpers.contrib.network import ufw from charmhelpers.contrib.charmsupport import nrpe from charmhelpers.contrib.hardening.harden import harden from charmhelpers.core.unitdata import kv from distutils.dir_util import mkpath import charmhelpers.contrib.openstack.vaultlocker as vaultlocker hooks = Hooks() CONFIGS = register_configs() NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins' SUDOERS_D = '/etc/sudoers.d' STORAGE_MOUNT_PATH = '/srv/node' UFW_DIR = '/etc/ufw' def add_ufw_gre_rule(ufw_rules_path): """Add allow gre rule to UFW Make a copy of existing UFW before rules, insert our new rule and replace existing rules with updated version. """ rule = '-A ufw-before-input -p 47 -j ACCEPT' rule_exists = False with tempfile.NamedTemporaryFile() as tmpfile: