corrected flake8 - too complex on get_facts

This commit is contained in:
Petr Klima committed 2020-11-03 20:04:16 +01:00
1 parent fa989927d5
commit 657bcc570d
1 file changed
+18 -14
+18 -14
View File
@@ -197,20 +197,7 @@ class S350Driver(NetworkDriver):
show_hosts = self._send_command('show hosts') show_hosts = self._send_command('show hosts')
show_int_st = self._send_command('show interface status') show_int_st = self._send_command('show interface status')
# os_version os_version = self._get_facts(show_ver)
# detect os ver > 2
if 'Active-image' in show_ver:
for line in show_ver.splitlines():
# First version line is the active version
if 'Version' in line:
_, os_version = line.split('Version: ')
break
else:
for line in show_ver.splitlines():
if 'SW version' in line:
_, ver = line.split(' ')
os_version, _ = ver.split(' (')
break
# hostname, uptime # hostname, uptime
for line in show_sys.splitlines(): for line in show_sys.splitlines():
@@ -265,6 +252,23 @@ class S350Driver(NetworkDriver):
'vendor': u'Cisco', 'vendor': u'Cisco',
} }
def _get_facts_parse_os_version(self, show_ver):
# os_version
# detect os ver > 2
if 'Active-image' in show_ver:
for line in show_ver.splitlines():
# First version line is the active version
if 'Version' in line:
_, os_version = line.split('Version: ')
break
else:
for line in show_ver.splitlines():
if 'SW version' in line:
_, ver = line.split(' ')
os_version, _ = ver.split(' (')
break
return os_version
def get_interfaces(self): def get_interfaces(self):
""" """
get_interfaces() implementation for S350 get_interfaces() implementation for S350