Charm hooks fails due to netifaces newer version
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Graylog Charm |
Fix Committed
|
Medium
|
Mert Kirpici |
Bug Description
While changing a config on graylog charm I got hit by
```
unit-graylog-0: 12:03:23 ERROR unit.graylog/
Traceback (most recent call last):
File "/var/lib/
bus.
File "/var/lib/
_invoke(
File "/var/lib/
handler.
File "/var/lib/
self.
File "/var/lib/
validate_
File "lib/charms/
netloc=
File "lib/charms/
iface = netifaces.
KeyError: 2
```
This showed up to be due to netifaces version in the virtual env of the charm
```
# netifaces==0.10.4
python3 -c 'import netifaces ; print(netifaces
{2: ('10.116.72.11', 'eth0'), 10: ('fa80:
# netifaces==0.11.0
/var/lib/
{10: ('fa80:
```
Downgrading netifaces<0.11 fixed the issue
```
/var/lib/
```
Related branches
- 🤖 prod-jenkaas-bootstack: Approve (continuous-integration)
- Tianqi Xiao (community): Approve
- Eric Chen: Approve
- BootStack Reviewers: Pending requested
-
Diff: 9 lines (+1/-1)1 file modifiedsrc/wheelhouse.txt (+1/-1)
Changed in charm-graylog: | |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: bseng-1410 |
Changed in charm-graylog: | |
assignee: | nobody → Mert Kirpici (mertkirpici) |
status: | Triaged → In Progress |
Changed in charm-graylog: | |
status: | In Progress → Triaged |
status: | Triaged → Confirmed |
Changed in charm-graylog: | |
assignee: | Mert Kirpici (mertkirpici) → nobody |
Changed in charm-graylog: | |
assignee: | nobody → Mert Kirpici (mertkirpici) |
status: | Confirmed → In Progress |
Changed in charm-graylog: | |
milestone: | none → 23.10 |
status: | In Progress → Fix Committed |
Root cause analysis shows that starting from netifaces v0.11.0: gateways( )["default" ] returns empty routing introduces a new table called "apitable" upon installation with a default route on it
1 - netifaces only considers routes as default if they are defined on the main table
2 - netifaces selects the route with the lowest metric(highest prio) to show as the "default"
3 - combining 1 and 2: if the default route with the lowest metric is not on the main table, netifaces.
4 - charm-advanced-
5 - the issue is observed when the default route with the lowest metric is not on the main table. Hence the error:
iface = netifaces. gateways( )["default" ][netifaces. AF_INET] [1]
KeyError: 2
where 2 represents netifaces.AF_INET.
The issue can be resolved by any of the following:
- making sure the default route with the lowest metric is on the main table.
- pinning down the netifaces package
- proposing a patch to netifaces-plus if this _should_ not be the right behavior.(I am not exactly convinced that the default route MUST be in the main table..)
Relating the bug to the charm-advanced- routing project as well