network icon indicating copy to clipboard operation
network copied to clipboard

_try_reapply failing to modify connection

Open zzzoom opened this issue 5 years ago • 0 comments

I ran into the following error on 1.2.0 while running the role to modify an existing infiniband connection:

[003] <info>  #0, state:up persistent_state:present, 'Infiniband0': update connection Infiniband0, 9db4c28a-4058-47c2-b963-d3b7fffb8a1f
[004] <info>  #0, state:up persistent_state:present, 'Infiniband0': up connection Infiniband0, 9db4c28a-4058-47c2-b963-d3b7fffb8a1f (is-modified)
[005] <warn>  #0, state:up persistent_state:present, 'Infiniband0': failure: Argument 1 does not allow None as a value (up) [[Traceback (most recent call last):
  File \"master:/home/bc/playbooks/roles/linux-system-roles.network/library/network_connections.py\", line 1850, in run
  File \"master:/home/bc/playbooks/roles/linux-system-roles.network/library/network_connections.py\", line 2222, in run_action_up
  File \"master:/home/bc/playbooks/roles/linux-system-roles.network/library/network_connections.py\", line 2259, in _try_reapply
  File \"master:/home/bc/playbooks/roles/linux-system-roles.network/library/network_connections.py\", line 1449, in reapply
  File \"/home/bc/playbooks/roles/linux-system-roles.network/module_utils/network_lsr/utils.py\", line 157, in call_async_method
TypeError: Argument 1 does not allow None as a value

The problem seems to be in https://github.com/linux-system-roles/network/blob/21de2fc95c73c210ceb03de019e68b593f9e5eee/library/network_connections.py#L2258 where reapply is called without passing a connection, which then calls call_async_method with None as connection. I haven't tried the main branch but _try_reapply remains the same so it's likely to persist.

I got it working with this patch, but I'm not sure it's the best way:

-                    self.nmutil.reapply(devices[0])
+                    self.nmutil.reapply(devices[0], active_connection.get_connection())

zzzoom avatar Dec 29 '20 20:12 zzzoom