Skip to content

ctx: fix a crash when attempting to restore hwaddr

Can't restore a hwaddr if the link is not a hardware one:

  Traceback (most recent call last):
    File "features/environment.py", line 222, in after_scenario
      _after_scenario(context, scenario)
    File "features/environment.py", line 360, in _after_scenario
      assert not excepts, "Exceptions in after scenario:\n\n" + "\n\n".join(excepts)
  AssertionError: Exceptions in after scenario:

  Traceback (most recent call last):
    File "/home/lkundrak/src/NetworkManager-ci/nmci/cleanup.py", line 339, in process_cleanup
      cleanup_action.do_cleanup()
    File "/home/lkundrak/src/NetworkManager-ci/nmci/cleanup.py", line 63, in do_cleanup
      self._do_cleanup()
    File "/home/lkundrak/src/NetworkManager-ci/nmci/cleanup.py", line 128, in _do_cleanup
      nmci.ctx.reset_hwaddr_nmcli(nmci.cext.context, self.iface)
    File "/home/lkundrak/src/NetworkManager-ci/nmci/ctx.py", line 695, in reset_hwaddr_nmcli
      nmci.process.run_stdout(f"ip link set {ifname} address {hwaddr}")
    File "/home/lkundrak/src/NetworkManager-ci/nmci/process.py", line 292, in run_stdout
      return self._run(
    File "/home/lkundrak/src/NetworkManager-ci/nmci/process.py", line 188, in _run
      raise Exception(
  Exception: `ip link set eth1 address not` returned exit code 1
  STDOUT:

  STDERR:
  "not" is invalid lladdr.

Merge request reports