add 1st fqdn part without trailing digits as keyword

This commit is contained in:
Frédéric Péters 2020-12-30 12:14:02 +01:00
parent 7f6760788f
commit 5b7c51b127
1 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,11 @@ class Server:
for j in range(i, len(parts)):
if i != j:
self.keywords.add('.'.join(parts[i:j+1]))
if i == 0:
# add first component without trailing digits, this allows
# matching db1.prod.saas.entrouvert.org with the db
# keyword.
self.keywords.add(re.sub(r'\d+$', '', parts[0]))
def __repr__(self):
return '<Server %s %r>' % (self.name, self.keywords)