Update typing for ip module
Change-Id: I6ddcc4bd459ca241e2b6134aeaefc2abc78da5c4
This commit is contained in:
parent
8566e877d7
commit
81f1ae18f7
|
@ -80,8 +80,8 @@ def parse_ip_address(text: str) -> typing.Tuple[netaddr.IPAddress, int]:
|
|||
return netaddr.IPAddress(address), prefix_len
|
||||
|
||||
|
||||
def list_network_namespaces(**execute_params):
|
||||
namespaces = tobiko.Selection()
|
||||
def list_network_namespaces(**execute_params) -> typing.List[str]:
|
||||
namespaces: typing.List[str] = []
|
||||
output = execute_ip(['-o', 'netns', 'list'], **execute_params)
|
||||
if output:
|
||||
for line in output.splitlines():
|
||||
|
@ -91,8 +91,8 @@ def list_network_namespaces(**execute_params):
|
|||
return namespaces
|
||||
|
||||
|
||||
def list_network_interfaces(**execute_params):
|
||||
interfaces = tobiko.Selection()
|
||||
def list_network_interfaces(**execute_params) -> typing.List[str]:
|
||||
interfaces: typing.List[str] = []
|
||||
output = execute_ip(['--brief', 'address', 'list'], **execute_params)
|
||||
if output:
|
||||
for line in output.splitlines():
|
||||
|
@ -115,7 +115,7 @@ IP_COMMAND = sh.shell_command(['/sbin/ip'])
|
|||
|
||||
|
||||
def execute_ip(ifconfig_args, ip_command=None, ignore_errors=False,
|
||||
**execute_params):
|
||||
**execute_params) -> str:
|
||||
if ip_command:
|
||||
ip_command = sh.shell_command(ip_command)
|
||||
else:
|
||||
|
|
|
@ -18,5 +18,5 @@ class NetworkNamespaceFixture(tobiko.SharedFixture):
|
|||
ignore_errors=True,
|
||||
ssh_client=node.ssh_client)
|
||||
if network_namespaces:
|
||||
self.network_namespace = network_namespaces.first
|
||||
self.network_namespace = network_namespaces[0]
|
||||
self.ssh_client = node.ssh_client
|
||||
|
|
Loading…
Reference in New Issue