File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ def start(self):
163
163
raise Fatal ('%r expected STARTED, got %r' % (self .argv , line ))
164
164
165
165
def sethostip (self , hostname , ip ):
166
- assert (not re .search (r'[^-\w]' , hostname ))
166
+ assert (not re .search (r'[^-\w\. ]' , hostname ))
167
167
assert (not re .search (r'[^0-9.]' , ip ))
168
168
self .pfile .write ('HOST %s,%s\n ' % (hostname , ip ))
169
169
self .pfile .flush ()
Original file line number Diff line number Diff line change @@ -51,15 +51,20 @@ def read_host_cache():
51
51
words = line .strip ().split (',' )
52
52
if len (words ) == 2 :
53
53
(name ,ip ) = words
54
- name = re .sub (r'[^-\w]' , '-' , name ).strip ()
54
+ name = re .sub (r'[^-\w\. ]' , '-' , name ).strip ()
55
55
ip = re .sub (r'[^0-9.]' , '' , ip ).strip ()
56
56
if name and ip :
57
57
found_host (name , ip )
58
-
59
58
60
- def found_host (hostname , ip ):
61
- hostname = re .sub (r'\..*' , '' , hostname )
62
- hostname = re .sub (r'[^-\w]' , '_' , hostname )
59
+
60
+ def found_host (full_hostname , ip ):
61
+ full_hostname = re .sub (r'[^-\w\.]' , '_' , full_hostname )
62
+ hostname = re .sub (r'\..*' , '' , full_hostname )
63
+ _insert_host (full_hostname , ip )
64
+ _insert_host (hostname , ip )
65
+
66
+
67
+ def _insert_host (hostname , ip ):
63
68
if (ip .startswith ('127.' ) or ip .startswith ('255.' )
64
69
or hostname == 'localhost' ):
65
70
return
You can’t perform that action at this time.
0 commit comments