-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into NRP-varnishes
- Loading branch information
Showing
176 changed files
with
6,800 additions
and
823 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ if __name__ == "__main__" and __package__ is None: | |
sys.path.append(_parent + "/src") | ||
|
||
import topology_utils | ||
from topology_utils import TopologyPoolManager | ||
import net_name_addr_utils | ||
|
||
# Parts of this implementation are from the following StackOverflow answer: | ||
|
@@ -116,10 +117,9 @@ 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"], | ||
help="Filter on contact type e.g. administrative, miscellaneous, security, submitter or site" | ||
"(default: all)", ) | ||
oparser.add_argument("--oim-contact-type", action="append", dest="contact_type", | ||
choices=["all"] + topology_utils.CONTACT_TYPES, | ||
help="Filter on contact type (default: all)") | ||
oparser.add_argument("--bypass-dns-check", action="store_true", dest="bypass_dns_check", | ||
help="Bypass checking that one of the host's IP addresses matches with the hostanme resolution") | ||
oparser.add_argument("--allow-non-ascii", action="store_true", dest="allow_non_ascii", | ||
|
@@ -132,6 +132,10 @@ def parseargs(): | |
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"] | ||
args.contact_type = set(args.contact_type) # remove dupes | ||
|
||
if args.from_name == 'security': | ||
args.from_name = 'OSG Security Team' | ||
args.from_addr = '[email protected]' | ||
|
@@ -179,13 +183,14 @@ def has_non_printable_ascii_characters(contents): | |
|
||
def main(): | ||
args = parseargs() | ||
|
||
pm = TopologyPoolManager() | ||
recipients = set(args.recipients.split()) | ||
if args.oim_recipients and 'vos' in args.oim_recipients: | ||
attempts = 3 | ||
while attempts > 0: | ||
try: | ||
results = topology_utils.get_vo_contacts(args) | ||
results = pm.get_vo_contacts(args) | ||
break | ||
except topology_utils.InvalidPathError as exc: | ||
print(exc) | ||
exit(1) | ||
|
@@ -208,9 +213,10 @@ def main(): | |
while attempts > 0: | ||
try: | ||
if args.fqdn_filter: | ||
results = topology_utils.get_resource_contacts_by_fqdn(args) | ||
results = pm.get_resource_contacts_by_fqdn(args) | ||
else: | ||
results = topology_utils.get_resource_contacts(args) | ||
results = pm.get_resource_contacts(args) | ||
break | ||
except topology_utils.InvalidPathError as exc: | ||
exit(str(exc)) | ||
except topology_utils.IncorrectPasswordError as exc: | ||
|
Oops, something went wrong.