Skip to content

Commit 366673e

Browse files
Merge pull request #398 from ISISComputingGroup/flash_printoutunknownhostnameip
print out when hostname lookup fails
2 parents e84b8a8 + 2331574 commit 366673e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

DatabaseServer/moxa_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,14 @@ def _update_snmp(self):
184184

185185
time.sleep(30)
186186

187-
def _get_moxa_num(self):
187+
def _get_moxa_num(self) -> str:
188188
return str(len(self._mappings[0].keys()))
189189

190-
def _get_hostname(self, ip_addr):
190+
def _get_hostname(self, ip_addr: str) -> str:
191191
try:
192192
return socket.gethostbyaddr(ip_addr)[0]
193193
except socket.herror:
194+
print(f"unknown hostname for IP address {ip_addr}")
194195
return "unknown"
195196

196197
def _get_mappings(self) -> Tuple[Dict[str, str], Dict[int, List[Tuple[int, int]]]]:

0 commit comments

Comments
 (0)