def get_rule(rule_id, session=None):
"""
Get a specific replication rule.
:param rule_id: The rule_id to select.
:param session: The database session in use.
:raises: RuleNotFound if no Rule can be found.
"""
try:
rule = session.query(models.ReplicationRule).filter_by(id=rule_id).one()
d = {}
for column in rule.__table__.columns:
d[column.name] = getattr(rule, column.name)
return d
except NoResultFound:
raise RuleNotFound('No rule with the id %s found' % (rule_id))
except StatementError:
raise RucioException('Badly formatted rule id (%s)' % (rule_id))
评论列表
文章目录