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 13
13
import gratia .common .GratiaWrapper as GratiaWrapper
14
14
import gratia .common .Gratia as Gratia
15
15
import gratia .common .config as config
16
+ from urllib .parse import urlparse
16
17
17
18
probe_version = "%%%RPMVERSION%%%"
18
19
@@ -55,8 +56,15 @@ def get(self, key):
55
56
56
57
57
58
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
60
68
61
69
def to_gratia_record (self ):
62
70
# TODO the following fields are not currently tracked:
You can’t perform that action at this time.
0 commit comments