def set_error(cluster_id, report={}, session=None, state='error', error_message=None): cluster = cluster_api.get_cluster_internal(cluster_id, session=session) logging.debug( "updates all reports as %s in cluster %s", state, cluster_id ) return utils.update_db_objects( session, models.HealthCheckReport, updates={ 'report': {}, 'state': 'error', 'error_message': error_message }, cluster_id=cluster.id )
def _update_others(other_session): """Update other tables.""" logging.info('update other tables') from compass.db.api import utils from compass.db import models utils.update_db_objects( other_session, models.Cluster ) utils.update_db_objects( other_session, models.Host ) utils.update_db_objects( other_session, models.ClusterHost )