fabric-testbed / fabrictestbed-extensions

Extensions for the fabric APUI/CLI.
MIT License
7 stars 12 forks source link

fablib.interface.get_ip_addr_show tries to return stdout when it does not exist #291

Closed nbastin closed 6 months ago

nbastin commented 7 months ago

fablib.interface.get_ip_addr_show returns stdout even in the case of an exception, when stdout does not exist as a local variable:


---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
Cell In[33], line 1
----> 1 n1intf.get_ip_addr_show()

File /usr/lib/python3.10/site-packages/fabrictestbed_extensions/fablib/interface.py:733, in Interface.get_ip_addr_show(self, dev)
    728     (f"Exception: {e}")
    729     logging.error(
    730         f"Failed to get ip addr show info for interface {self.get_name()}"
    731     )
--> 733 return stdout

UnboundLocalError: local variable 'stdout' referenced before assignment```
sajith commented 6 months ago

@nbastin Apologies for coming to this late, but do you happen to remember which version of the library you were using?

This seems to be fixed in main (commit a9f5affd04074c9a5b08bbfdb9100e6901802a8d):

https://github.com/fabric-testbed/fabrictestbed-extensions/blob/00a072c9a466939fa09f577fe4bb75df9a39b9e7/fabrictestbed_extensions/fablib/interface.py#L733-L746

nbastin commented 6 months ago

1.6.4, which is still the latest on pypi.