source:
people/peter.buschman/backup_monitoring/parsing/routines/_routines.py@
1252
Last change on this file since 1252 was 976, checked in by , on Dec 6, 2011 at 10:19:33 AM | |
---|---|
File size: 315 bytes |
Line | |
---|---|
1 | |
2 | import re |
3 | |
4 | re_fqdn = re.compile('^([a-zA-Z0-9\-_]+).([a-zA-Z0-9\-_.]+)$') |
5 | |
6 | ## |
7 | ## strip_domain() - strip the domain from a fully-qualified hostname |
8 | ## |
9 | def strip_domain(hostname): |
10 | |
11 | match = re_fqdn.match(hostname) |
12 | |
13 | if match: |
14 | return match.group(1) |
15 | else: |
16 | return hostname |
17 | |
18 |
Note:
See TracBrowser
for help on using the repository browser.