def update_notification_list_db(self, session, key, value, notification_id): """ Notification list table update :param :key: Update column name :param :value: Updated value :param :notification_id: Notification ID (updated narrowing condition of notification list table) """ try: # Update progress with update_at and delete_at now = datetime.datetime.now() update_val = {'update_at': now} if key == 'progress': update_val['progress'] = value update_val['delete_at'] = now # Updated than progress else: if hasattr(NotificationList, key): update_val[key] = value else: raise AttributeError dbapi.update_notification_list_dict( session, notification_id, update_val) self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0011", syslog.LOG_INFO) except AttributeError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : %s is not in attribute of \ NotificationList" % (key) self.rc_util.syslogout(msg, syslog.LOG_ERR) raise AttributeError except exc.SQLAlchemyError: self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0014", syslog.LOG_ERR) error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : SQLAlchemy.Error in \ update_notification_list_db()." self.rc_util.syslogout(msg, syslog.LOG_ERR) raise exc.SQLAlchemyError except KeyError: self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0013", syslog.LOG_ERR) error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : KeyError in update_notification_list_db()." self.rc_util.syslogout(msg, syslog.LOG_ERR) raise KeyError
def update_notification_list_db(self, session, key, value, notification_id): """ Notification list table update :param :key: Update column name :param :value: Updated value :param :notification_id: Notification ID (updated narrowing condition of notification list table) """ try: # Update progress with update_at and delete_at now = datetime.datetime.now() update_val = {'update_at': now} if key == 'progress': update_val['progress'] = value update_val['delete_at'] = now # Updated than progress else: if hasattr(NotificationList, key): update_val[key] = value else: raise AttributeError msg = "Do update_notification_list_dict." LOG.info(msg) dbapi.update_notification_list_dict( session, notification_id, update_val) msg = "Succeeded in update_notification_list_dict." LOG.info(msg) except AttributeError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : %s is not in attribute of \ NotificationList" % (key) LOG.error(msg) raise AttributeError except exc.SQLAlchemyError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : SQLAlchemy.Error in \ update_notification_list_db()." LOG.error(msg) raise exc.SQLAlchemyError except KeyError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : KeyError in update_notification_list_db()." LOG.error(msg) raise KeyError
def update_notification_list_db(self, session, key, value, notification_id): """ Notification list table update :param :key: Update column name :param :value: Updated value :param :notification_id: Notification ID (updated narrowing condition of notification list table) """ try: # Update progress with update_at and delete_at now = datetime.datetime.now() update_val = {'update_at': now} if key == 'progress': update_val['progress'] = value update_val['delete_at'] = now # Updated than progress else: if hasattr(NotificationList, key): update_val[key] = value else: raise AttributeError msg = "Do update_notification_list_dict." LOG.info(msg) dbapi.update_notification_list_dict(session, notification_id, update_val) msg = "Succeeded in update_notification_list_dict." LOG.info(msg) except AttributeError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : %s is not in attribute of \ NotificationList" % (key) LOG.error(msg) raise AttributeError except exc.SQLAlchemyError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : SQLAlchemy.Error in \ update_notification_list_db()." LOG.error(msg) raise exc.SQLAlchemyError except KeyError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) LOG.error(error_type) LOG.error(error_value) for tb in tb_list: LOG.error(tb) msg = "Exception : KeyError in update_notification_list_db()." LOG.error(msg) raise KeyError
def update_notification_list_db(self, session, key, value, notification_id): """ Notification list table update :param :key: Update column name :param :value: Updated value :param :notification_id: Notification ID (updated narrowing condition of notification list table) """ try: # Update progress with update_at and delete_at now = datetime.datetime.now() update_val = {'update_at': now} if key == 'progress': update_val['progress'] = value update_val['delete_at'] = now # Updated than progress else: if hasattr(NotificationList, key): update_val[key] = value else: raise AttributeError dbapi.update_notification_list_dict(session, notification_id, update_val) self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0011", syslog.LOG_INFO) except AttributeError: error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : %s is not in attribute of \ NotificationList" % (key) self.rc_util.syslogout(msg, syslog.LOG_ERR) raise AttributeError except exc.SQLAlchemyError: self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0014", syslog.LOG_ERR) error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : SQLAlchemy.Error in \ update_notification_list_db()." self.rc_util.syslogout(msg, syslog.LOG_ERR) raise exc.SQLAlchemyError except KeyError: self.rc_util.syslogout_ex("RecoveryControllerUtilDb_0013", syslog.LOG_ERR) error_type, error_value, traceback_ = sys.exc_info() tb_list = traceback.format_tb(traceback_) self.rc_util.syslogout(error_type, syslog.LOG_ERR) self.rc_util.syslogout(error_value, syslog.LOG_ERR) for tb in tb_list: self.rc_util.syslogout(tb, syslog.LOG_ERR) msg = "Exception : KeyError in update_notification_list_db()." self.rc_util.syslogout(msg, syslog.LOG_ERR) raise KeyError