Skip to content

Commit

Permalink
Merge pull request #3590 from osg-cat/catworks
Browse files Browse the repository at this point in the history
Enabled multiple contact types and added "local" types
  • Loading branch information
brianhlin authored Jan 19, 2024
2 parents c617fd5 + 381ddaa commit f01b581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions bin/osg-notify
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ def parseargs():
oparser.add_argument("--oim-owner-filter", dest="owner_vo",
help="Filter on resources that list VO(s) as a partial owner")

oparser.add_argument("--oim-contact-type", default="all", dest="contact_type",
choices=["all", "administrative", "miscellaneous", "security", "submitter", "site"],
# should be safe to set default=set() here since we don't call parse_args() twice
oparser.add_argument("--oim-contact-type", action="append", default=set(), dest="contact_type",
choices=["all", "administrative", "miscellaneous", "security", "submitter", "site",
"local operational", "local security"],
help="Filter on contact type e.g. administrative, miscellaneous, security, submitter or site"
"(default: all)", )
oparser.add_argument("--bypass-dns-check", action="store_true", dest="bypass_dns_check",
Expand All @@ -131,6 +133,8 @@ def parseargs():
oparser.error("--oim-owner-filter and --oim-recipients=vos options are conflicting")
if args.name_filter and args.fqdn_filter:
oparser.error("Can't specify both --oim-name-filter and --oim-fqdn-filter")
if not args.contact_type or ("all" in args.contact_type):
args.contact_type = ["all"]

if args.from_name == 'security':
args.from_name = 'OSG Security Team'
Expand Down
7 changes: 4 additions & 3 deletions src/topology_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,15 @@ def filter_contacts(args, results):
args.fqdn_filter not in fqdn:
del results[fqdn]

if args.contact_type != 'all':
if 'all' not in args.contact_type:
# filter out undesired contact types
for name in list(results):
contact_list = []
for contact in results[name]:
contact_type = contact['ContactType']
if contact_type.startswith(args.contact_type):
contact_list.append(contact)
for args_contact_type in args.contact_type:
if contact_type.startswith(args_contact_type):
contact_list.append(contact)
if contact_list == []:
del results[name]
else:
Expand Down

0 comments on commit f01b581

Please sign in to comment.