File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1313import gratia .common .GratiaWrapper as GratiaWrapper
1414import gratia .common .Gratia as Gratia
1515import gratia .common .config as config
16+ from urllib .parse import urlparse
1617
1718probe_version = "%%%RPMVERSION%%%"
1819
@@ -55,8 +56,15 @@ def get(self, key):
5556
5657
5758 def site_probe (self ):
58- site_dns = re .sub (r'[^a-zA-Z0-9-]' , '-' , self .get ('Site' )).strip ('-' ) # sanitize site
59- return "kubernetes:%s.gratia.osg-htc.org" % site_dns
59+ """ Get the domain from the record's SubmitHost, removing scheme and path if present """
60+ submit_host = self .get ('SubmitHost' )
61+ # Hack: Make sure the submitHost starts with a protocol so urllib can parse it
62+ if not re .match ('[A-Za-z]*://' , submit_host ):
63+ submit_host = f"https://{ submit_host } "
64+ probe_domain = urlparse (submit_host ).hostname
65+ if not probe_domain :
66+ raise Exception (f"Unable to determine probe domain from submit host { self .get ('SubmitHost' )} " )
67+ return probe_domain
6068
6169 def to_gratia_record (self ):
6270 # TODO the following fields are not currently tracked:
You can’t perform that action at this time.
0 commit comments