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.get_upstream_version.assert_called_with(utils.VERSION_PACKAGE) self.application_version_set.assert_called_with('10.2.2')
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.get_upstream_version.assert_called_with( utils.VERSION_PACKAGE ) self.application_version_set.assert_called_with('10.2.2')
for r_id in relation_ids('identity-service'): identity_joined(relid=r_id) @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() @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)
@hooks.hook('leader-settings-changed') def leader_settings_changed(): # NOTE: leader unit will only ever set leader storage # data when multi-site realm, zonegroup, zone or user # data has been created/changed - trigger restarts # of rgw services. if restart_nonce_changed(leader_get('restart_nonce')): service_restart(service_name()) if not is_leader(): for r_id in relation_ids('master'): master_relation_joined(r_id) def process_multisite_relations(): """Re-trigger any pending master/slave relations""" for r_id in relation_ids('master'): master_relation_joined(r_id) for r_id in relation_ids('slave'): for unit in related_units(r_id): slave_relation_changed(r_id, unit) if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)