3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

autotests: Fix class variables that should be object vars

Due to those variables being global (IWD class variables) calling either
unregister_psk_agent or del on one IWD class instance would unregister
all agents on all instances.  Move .psk_agents and two other class
variables to the object.  They were already referenced using "self."
as if they were object variables throughout the class.
This commit is contained in:
Andrew Zaborowski 2022-08-23 18:36:15 +02:00 committed by Denis Kenzior
parent f6a890f5cb
commit 818ec70549

View File

@ -1091,17 +1091,15 @@ class IWD(AsyncOpAbstract):
some tests do require starting IWD using this constructor (by passing
start_iwd_daemon=True)
'''
_object_manager_if = None
_iwd_proc = None
_devices = None
_default_instance = None
psk_agents = []
def __init__(self, start_iwd_daemon = False, iwd_config_dir = '/tmp',
iwd_storage_dir = IWD_STORAGE_DIR, namespace=ctx,
developer_mode = True):
self.namespace = namespace
self._bus = namespace.get_bus()
self._object_manager_if = None
self._iwd_proc = None
if start_iwd_daemon:
if self.namespace.is_process_running('iwd'):
@ -1120,6 +1118,8 @@ class IWD(AsyncOpAbstract):
if self.namespace.name is None:
IWD._default_instance = weakref.ref(self)
self.psk_agents = []
def __del__(self):
for agent in self.psk_agents:
self.unregister_psk_agent(agent)