def test_assess_status(self): with patch.object(utils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee utils.assess_status('test-config') asf.assert_called_once_with('test-config') callee.assert_called_once_with() self.os_application_version_set.assert_called_with( utils.VERSION_PACKAGE)
def test_assess_status(self): with patch.object(utils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee utils.assess_status('test-config') asf.assert_called_once_with('test-config') callee.assert_called_once_with() self.os_application_version_set.assert_called_with( utils.VERSION_PACKAGE )
"python-os-brick", "python-oslo.rootwrap"] apt_install(filter_installed_packages(optional_packages), fatal=True) @hooks.hook('cinder-volume-service-relation-joined') @os_requires_version('mitaka', 'glance-common') @restart_on_change(restart_map(), stopstart=True) def cinder_volume_service_relation_joined(relid=None): install_packages_for_cinder_store() CONFIGS.write_all() @hooks.hook('storage-backend-relation-changed') @os_requires_version('mitaka', 'glance-common') @restart_on_change(restart_map(), stopstart=True) def storage_backend_hook(): if 'storage-backend' not in CONFIGS.complete_contexts(): juju_log('storage-backend relation incomplete. Peer not ready?') return install_packages_for_cinder_store() CONFIGS.write(GLANCE_API_CONF) if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: juju_log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)
@hooks.hook('amqp-relation-changed') @restart_on_change(restart_map()) def amqp_changed(): if 'amqp' not in CONFIGS.complete_contexts(): juju_log('amqp relation incomplete. Peer not ready?') return CONFIGS.write(GLANCE_API_CONF) @hooks.hook('nrpe-external-master-relation-joined', 'nrpe-external-master-relation-changed') def update_nrpe_config(): # python-dbus is used by check_upstart_job apt_install('python-dbus') hostname = nrpe.get_nagios_hostname() current_unit = nrpe.get_nagios_unit_name() nrpe_setup = nrpe.NRPE(hostname=hostname) nrpe.copy_nrpe_checks() nrpe.add_init_service_checks(nrpe_setup, services(), current_unit) nrpe.add_haproxy_checks(nrpe_setup, current_unit) nrpe_setup.write() if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: juju_log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)