Skip to content

Commit

Permalink
Rules: Upadating Comments in Rules Fix rucio#4116
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvSondhi committed Mar 19, 2021
1 parent 54830db commit c51a5a6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/rucio/core/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
@transactional_session
def add_rule(dids, account, copies, rse_expression, grouping, weight, lifetime, locked, subscription_id,
source_replica_expression=None, activity='User Subscriptions', notify=None, purge_replicas=False,
ignore_availability=False, comment=None, ask_approval=False, asynchronous=False, ignore_account_limit=False,
ignore_availability=False, comments=None, ask_approval=False, asynchronous=False, ignore_account_limit=False,
priority=3, delay_injection=None, split_container=False, meta=None, session=None, logger=logging.log):
"""
Adds a replication rule for every did in dids
Expand All @@ -124,7 +124,7 @@ def add_rule(dids, account, copies, rse_expression, grouping, weight, lifetime,
:param notify: Notification setting of the rule ('Y', 'N', 'C'; None = 'N').
:param purge_replicas: Purge setting if a replica should be directly deleted after the rule is deleted.
:param ignore_availability: Option to ignore the availability of RSEs.
:param comment: Comment about the rule.
:param comments: Comment(s) about the rule.
:param ask_approval: Ask for approval for this rule.
:param asynchronous: Create replication rule asynchronously by the judge-injector.
:param delay_injection: Create replication after 'delay' seconds. Implies asynchronous=True.
Expand Down Expand Up @@ -256,7 +256,7 @@ def add_rule(dids, account, copies, rse_expression, grouping, weight, lifetime,
notification=notify,
purge_replicas=purge_replicas,
ignore_availability=ignore_availability,
comments=comment,
comments=comments,
ignore_account_limit=ignore_account_limit,
priority=priority,
split_container=split_container,
Expand Down Expand Up @@ -546,7 +546,7 @@ def add_rules(dids, rules, session=None, logger=logging.log):
notification=notify,
purge_replicas=rule.get('purge_replicas', False),
ignore_availability=rule.get('ignore_availability', False),
comments=rule.get('comment', None),
comments=rule.get('comments', None),
priority=rule.get('priority', 3),
split_container=rule.get('split_container', False),
meta=meta,
Expand Down Expand Up @@ -696,7 +696,7 @@ def inject_rule(rule_id, session=None, logger=logging.log):
subscription_id=None,
activity=rule.activity,
notify=notify,
comment=rule.comments,
comments=rule.comments,
asynchronous=True,
ignore_availability=rule.ignore_availability,
ignore_account_limit=True,
Expand Down Expand Up @@ -1282,7 +1282,7 @@ def update_rule(rule_id, options, session=None):
:raises: RuleNotFound if no Rule can be found, InputValidationError if invalid option is used, ScratchDiskLifetimeConflict if wrong ScratchDiskLifetime is used.
"""

valid_options = ['locked', 'lifetime', 'account', 'state', 'activity', 'source_replica_expression', 'cancel_requests', 'priority', 'child_rule_id', 'eol_at', 'meta', 'purge_replicas']
valid_options = ['locked', 'lifetime', 'account', 'state', 'activity', 'source_replica_expression', 'cancel_requests', 'priority', 'child_rule_id', 'eol_at', 'meta', 'purge_replicas', 'comments']

for key in options:
if key not in valid_options:
Expand Down Expand Up @@ -1515,7 +1515,7 @@ def move_rule(rule_id, rse_expression, session=None):
notify=notify,
purge_replicas=rule.purge_replicas,
ignore_availability=rule.ignore_availability,
comment=rule.comments,
comments=rule.comments,
session=session)

session.flush()
Expand Down Expand Up @@ -2052,7 +2052,7 @@ def generate_email_for_rule_ok_notification(rule, session=None):
'created_at': str(rule.created_at),
'expires_at': str(rule.expires_at),
'rse_expression': rule.rse_expression,
'comment': rule.comments,
'comments': rule.comments,
'scope': rule.scope.external,
'name': rule.name,
'did_type': rule.did_type})
Expand Down Expand Up @@ -2125,7 +2125,7 @@ def approve_rule(rule_id, approver=None, notify_approvers=True, session=None):
text = template.safe_substitute({'rule_id': str(rule.id),
'expires_at': str(rule.expires_at),
'rse_expression': rule.rse_expression,
'comment': rule.comments,
'comments': rule.comments,
'scope': rule.scope.external,
'name': rule.name,
'did_type': rule.did_type,
Expand Down Expand Up @@ -2182,7 +2182,7 @@ def deny_rule(rule_id, approver=None, reason=None, session=None):
if email:
email_body = template.safe_substitute({'rule_id': str(rule.id),
'rse_expression': rule.rse_expression,
'comment': rule.comments,
'comments': rule.comments,
'scope': rule.scope.external,
'name': rule.name,
'did_type': rule.did_type,
Expand Down Expand Up @@ -3083,7 +3083,7 @@ def __create_rule_approval_email(rule, session=None):
'account': rule.account.external,
'email': get_account(account=rule.account, session=session).email,
'rse_expression': rule.rse_expression,
'comment': rule.comments,
'comments': rule.comments,
'scope': rule.scope.external,
'name': rule.name,
'did_type': rule.did_type,
Expand Down

0 comments on commit c51a5a6

Please sign in to comment.