def test_assess_status(self): with patch.object(neutron_utils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee neutron_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( neutron_utils.VERSION_PACKAGE)
def test_assess_status(self): with patch.object(neutron_utils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee neutron_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( neutron_utils.VERSION_PACKAGE )
def restart(args): """Restart services. :param args: Unused :type args: List[str] """ deferred_only = action_get("deferred-only") services = action_get("services").split() # Check input if deferred_only and services: action_fail("Cannot set deferred-only and services") return if not (deferred_only or services): action_fail("Please specify deferred-only or services") return if action_get('run-hooks'): log("Charm does not defer any hooks at present", DEBUG) if deferred_only: os_utils.restart_services_action(deferred_only=True) else: os_utils.restart_services_action(services=services) assess_status(register_configs())
stop_neutron_ha_monitor_daemon() remove_legacy_ha_files() @hooks.hook('update-status') @harden() def update_status(): log('Updating status.') @hooks.hook('pre-series-upgrade') def pre_series_upgrade(): log("Running prepare series upgrade hook", "INFO") series_upgrade_prepare( pause_unit_helper, CONFIGS) @hooks.hook('post-series-upgrade') def post_series_upgrade(): log("Running complete series upgrade hook", "INFO") series_upgrade_complete( resume_unit_helper, CONFIGS) if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)
} relation_set(corosync_bindiface=cluster_config['ha-bindiface'], corosync_mcastport=cluster_config['ha-mcastport'], resources=resources, resource_params=resource_params, clones=clones) @hooks.hook('ha-relation-departed') def ha_relation_destroyed(): # If e.g. we want to upgrade to Juno and use native Neutron HA support then # we need to un-corosync-cluster to enable the transition. if config('ha-legacy-mode'): stop_neutron_ha_monitor_daemon() remove_legacy_ha_files() @hooks.hook('update-status') @harden() def update_status(): log('Updating status.') if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)
def main(): try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)