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

ip plugin empty interface #1509

Closed
gyakovlev opened this issue Jul 21, 2019 · 3 comments
Closed

ip plugin empty interface #1509

gyakovlev opened this issue Jul 21, 2019 · 3 comments
Labels
Milestone

Comments

@gyakovlev
Copy link

gyakovlev commented Jul 21, 2019

Description

ip plugin has multiple issues with no interfaces defined.

Versions

  • Glances & psutil (glances -V): Glances v3.1.1 with psutil v5.6.1
  • Operating System (lsb_release -a): Gentoo current

Logs

tests are running in empty network namespace, probably it triggers the following issues:

running test

Error while initializing the ip plugin ('NoneType' object has no attribute 'split')

I believe this is because of f08abbf#diff-351a7e7d7317e2c261dfd3d4d71312bd

also test fails itself now, it was fine in 3.1.0 under empty network namespace an no interfaces are seen.
3.1.1

ERROR: test_012_ip (__main__.TestGlances)
Check IP plugin.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unitest.py", line 197, in test_012_ip
    stats_grab = stats.get_plugin('ip').get_raw()
AttributeError: 'NoneType' object has no attribute 'get_raw'

3.1.0

==============================================================================
INFO: [TEST_012] Check IP stats
INFO: IP stats: {}

affects runtime as well, with no network interfaces glances fails.

easy reproducer

unshare -n glances

3.1.0 will work
3.1.1 will crash

Error while initializing the ip plugin ('NoneType' object has no attribute 'split')
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.6/glances", line 11, in <module>
    load_entry_point('Glances==3.1.1', 'console_scripts', 'glances')()
  File "/usr/lib64/python3.6/site-packages/glances/__init__.py", line 140, in main
    start(config=config, args=args)
  File "/usr/lib64/python3.6/site-packages/glances/__init__.py", line 109, in start
    mode.serve_forever()
  File "/usr/lib64/python3.6/site-packages/glances/standalone.py", line 149, in serve_forever
    loop = self.__serve_forever()
  File "/usr/lib64/python3.6/site-packages/glances/standalone.py", line 136, in __serve_forever
    ret = not self.screen.update(self.stats, duration=adapted_refresh)
  File "/usr/lib64/python3.6/site-packages/glances/outputs/glances_curses.py", line 980, in update
    self.flush(stats, cs_status=cs_status)
  File "/usr/lib64/python3.6/site-packages/glances/outputs/glances_curses.py", line 955, in flush
    self.display(stats, cs_status=cs_status)
  File "/usr/lib64/python3.6/site-packages/glances/outputs/glances_curses.py", line 580, in display
    self.__display_header(__stat_display)
  File "/usr/lib64/python3.6/site-packages/glances/outputs/glances_curses.py", line 638, in __display_header
    self.get_stats_display_width(stat_display["uptime"]) + 1)
KeyError: 'ip'

which, I believe is because of a55092e#diff-351a7e7d7317e2c261dfd3d4d71312bd

@nicolargo nicolargo changed the title ip plugin empty interffaces ip plugin empty interface Jul 24, 2019
@nicolargo nicolargo added this to the Glances 3.1.2 milestone Jul 24, 2019
@nicolargo nicolargo added the bug label Jul 24, 2019
@nicolargo
Copy link
Owner

Corrected in #1528

@primeos
Copy link

primeos commented Aug 28, 2019

I'm still getting the

Error while initializing the ip plugin ('NoneType' object has no attribute 'split')

error message for Glances 3.1.2 inside of the Nix build sandbox, which uses network namespaces as well.

It isn't a big problem for me (only have to disable the IP module check during the build and it works outside of the build sandbox), but it seemed like a good idea to note it here in case it matters.

Version 3.1.0 was still fine:

Unitary tests for Glances 3.1.0

[...]

==============================================================================
INFO: [TEST_012] Check IP stats
INFO: IP stats: {}

While 3.1.1:

Error while initializing the ip plugin ('NoneType' object has no attribute 'split')
s.sssss.....E............
======================================================================
ERROR: test_012_ip (__main__.TestGlances)
Check IP plugin.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unitest.py", line 202, in test_012_ip
    stats_grab = stats.get_plugin('ip').get_raw()
AttributeError: 'NoneType' object has no attribute 'get_raw'

----------------------------------------------------------------------
Ran 25 tests in 0.041s

FAILED (errors=1, skipped=6)
Unitary tests for Glances 3.1.1

and 3.1.2:

Error while initializing the ip plugin ('NoneType' object has no attribute 'split')
s.sssss.....E............
======================================================================
ERROR: test_012_ip (__main__.TestGlances)
Check IP plugin.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unitest.py", line 202, in test_012_ip
    stats_grab = stats.get_plugin('ip').get_raw()
AttributeError: 'NoneType' object has no attribute 'get_raw'

----------------------------------------------------------------------
Ran 25 tests in 0.043s

FAILED (errors=1, skipped=6)
Unitary tests for Glances 3.1.2

cause problems with the IP plugin (as @gyakovlev already noted for 3.1.1 - the line numbers don't match because I already skip some of the other tests).

iproute2 shows the following:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

Edit: @nicolargo does is still work on your system with unshare -n glances?

@gyakovlev
Copy link
Author

@primeos as for me and gentoo build new version 3.1.2 corrected build and unshare -n crashes, so I can't confirm issues you have.

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

3 participants