Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some services could fail when JSNG runs on machines with virtual network interfaces like TUN #604

Open
sameh-farouk opened this issue Apr 5, 2022 · 0 comments
Labels

Comments

@sameh-farouk
Copy link
Member

sameh-farouk commented Apr 5, 2022

Description

get_default_ip_config function from nettools slas has an issue that causes some services which depend on it to fail, most notably the admin_alerts_notifier

Detalis

KeyError 'address' raised from internal function _clean on machines that have tun interfaces, as the tun interface has no default mac address and the function expect the 'address' key to always exist.

$ more /sys/class/net/*/address | cat
::::::::::::::
/sys/class/net/br-43db53252048/address
::::::::::::::
02:42:00:dd:d2:7e
::::::::::::::
/sys/class/net/docker0/address
::::::::::::::
02:42:0f:ef:2f:53
::::::::::::::
/sys/class/net/enp2s0/address
::::::::::::::
54:48:10:d3:ea:08
::::::::::::::
/sys/class/net/lo/address
::::::::::::::
00:00:00:00:00:00
::::::::::::::
/sys/class/net/tun0/address
::::::::::::::

::::::::::::::
/sys/class/net/wlp3s0/address
::::::::::::::
d8:9c:67:2a:f2:53

TFTshop was generating this error on my local machine, Alerts support notifier service was failing because of this, if TFTshop, or any software that have JSNG as dependencies, runs on a machine that has TUN interface (or other virtual network interfaces with no mac address), some services could fail.

Steps to reproduce

on a machine with tun interface, e.g, you have yggdrasil installed, inside jsng shell do:

j.sals.nettools.get_default_ip_config()
2022-04-05 12:21:23.020 | ERROR    | jumpscale.tools.errorhandler.errorhandler:_handle_exception:93 - KeyError: 'address'

Traceback/Logs/Alerts

this was taken from TFTshop logs

2022-04-05 01:20:58.640 | INFO     | alerts_notifier:job:13 - Alerts support notifier service: service started
Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "/home/sameh/projects/it_as_energy_shop/.venv/lib/python3.8/site-packages/jumpscale/packages/admin/services/alerts_notifier.py", line 19, in job
    ip_info = j.sals.nettools.get_default_ip_config()
  File "/home/sameh/projects/it_as_energy_shop/.venv/lib/python3.8/site-packages/jumpscale/sals/nettools/__init__.py", line 316, in get_default_ip_config
    for nic in get_network_info():
  File "/home/sameh/projects/it_as_energy_shop/.venv/lib/python3.8/site-packages/jumpscale/sals/nettools/__init__.py", line 383, in get_network_info
    for nic in _get_info():
  File "/home/sameh/projects/it_as_energy_shop/.venv/lib/python3.8/site-packages/jumpscale/sals/nettools/__init__.py", line 375, in _get_info
    yield _clean(nic_info)
  File "/home/sameh/projects/it_as_energy_shop/.venv/lib/python3.8/site-packages/jumpscale/sals/nettools/__init__.py", line 349, in _clean
    "mac": nic_info["address"],
KeyError: 'address'
2022-04-04T23:20:58Z <Greenlet at 0x7f8e71f356a0: <bound method AlertsNotifier.job of <alerts_notifier.AlertsNotifier object at 0x7f8e71ed7190>>> failed with KeyError
@sameh-farouk sameh-farouk changed the title KeyError: 'address' some services could fail when JSNG runs on machines with virtual network interfaces like TUN Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant