1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: bond: ifquery-check: es-sys-mac value is not part of netlink dump for non-root run

For some reason es-sys-mac (IFLA_BOND_AD_ACTOR_SYSTEM) is not part
of the netlink dump if requested by non-root user. This commit adds
a log info and will ignore es-sys-mac in that case.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2022-03-15 17:38:56 +01:00
parent e21ee6df28
commit 3199dd8a0d

View File

@ -920,6 +920,15 @@ class bond(Addon, moduleBase):
"es-sys-mac": lambda x: str(x).lower()
}
if "es-sys-mac" in iface_attrs and os.geteuid() != 0:
# for some reason es-sys-mac (IFLA_BOND_AD_ACTOR_SYSTEM) is not part
# of the netlink dump if requested by non-root user
try:
iface_attrs.remove("es-sys-mac")
self.logger.info("%s: non-root user can't check attribute \"es-sys-mac\" value" % ifaceobj.name)
except:
pass
for attr in iface_attrs:
nl_attr = self._bond_attr_netlink_map[attr]
translate_func = self._bond_attr_ifquery_check_translate_func[nl_attr]