WLAN-Pi / wlanpi-profiler

Wi-Fi client capabilities analyzer tool built for the WLAN Pi
BSD 3-Clause "New" or "Revised" License
25 stars 8 forks source link

improve oui update failure message when WLAN Pi is not connected to the Internet #46

Closed joshschmelzle closed 2 years ago

joshschmelzle commented 3 years ago

wlanpi@wlanpi-orange:[/usr/local/lib/python3.7/dist-packages/manuf]: sudo profiler --oui_update
[sudo] password for wlanpi:
2020-11-27 16:33:00,342 [ERROR] update_manuf: problem updating manuf. make sure manuf is installed...
Traceback (most recent call last):
  File "/opt/wlanpi/pipx/venvs/profiler2/lib/python3.7/site-packages/profiler2/helpers.py", line 511, in update_manuf
    capture_output=True,
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['sudo', 'manuf', '--update']' returned non-zero exit status 1.
exiting...
wlanpi@wlanpi-orange:[/usr/local/lib/python3.7/dist-packages/manuf]: sudo manuf --update
Traceback (most recent call last):
  File "/usr/lib/python3.7/urllib/request.py", line 1324, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 1399, in connect
    super().connect()
  File "/usr/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/manuf/manuf.py", line 144, in update
    response = urlopen(Request(manuf_url, headers={'User-Agent': 'Mozilla'}))
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 1367, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.7/urllib/request.py", line 1326, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/manuf", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/manuf/manuf.py", line 324, in main
    parser = MacParser(manuf_name=args.manuf, update=args.update)
  File "/usr/local/lib/python3.7/dist-packages/manuf/manuf.py", line 70, in __init__
    self.update()
  File "/usr/local/lib/python3.7/dist-packages/manuf/manuf.py", line 146, in update
    raise URLError("Failed downloading OUI database")
urllib.error.URLError: <urlopen error Failed downloading OUI database>
joshschmelzle commented 2 years ago

When --oui_update fails we don't hide the errors anymore in 8dc0b03cc7ed080dbcf12e74e5cd22e4cef29c13.