fabric-testbed / fabrictestbed-extensions

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

No method to get interface IP address returns a reliable type #296

Open nbastin opened 7 months ago

nbastin commented 7 months ago

Interface.get_ip_addr_ssh claims to return a string, but might return a list or dictionary.

Interface.get_ip_addr has an undocumented return, and ostensibly could return either an ip_address object or a string (falling back to get_ip_addr_ssh), but realistically could return any python object, since there's no gatekeeping on the contents of fablib_data[self.ADDR].

Interface.get_ips returns a list of anything, although oddly it often returns an empty list, even when the other methods work.

This means that a client either has to implement a rich type-inspection-and-handling regime, or more realistically, just ignore Interface and Node and implement everything themselves.

sajith commented 6 months ago

From a quick look, get_ip_addr_ssh() seems to contain some institutional knowledge that I do not have. Will ask around.

Also it sounds like it might be a good idea to run mypy against fablib. mypy fabrictestbed_extensions/fablib/interface.py do report several issues.