mirror of
https://github.com/napalm-automation-community/napalm-vyos.git
synced 2026-09-22 20:21:16 +00:00
Improve SyntaxWarning for empty string checks
This commit is contained in:
@@ -178,7 +178,7 @@ class VyOSDriver(NetworkDriver):
|
|||||||
self.device.send_command("cp "+self._BOOT_FILENAME+" "
|
self.device.send_command("cp "+self._BOOT_FILENAME+" "
|
||||||
+ self._BACKUP_FILENAME)
|
+ self._BACKUP_FILENAME)
|
||||||
self._new_config = f.read()
|
self._new_config = f.read()
|
||||||
cfg = [x for x in self._new_config.split("\n") if x is not ""]
|
cfg = [x for x in self._new_config.split("\n") if x]
|
||||||
output_loadcmd = self.device.send_config_set(cfg)
|
output_loadcmd = self.device.send_config_set(cfg)
|
||||||
match_setfailed = re.findall("Delete failed", output_loadcmd)
|
match_setfailed = re.findall("Delete failed", output_loadcmd)
|
||||||
match_delfailed = re.findall("Set failed", output_loadcmd)
|
match_delfailed = re.findall("Set failed", output_loadcmd)
|
||||||
@@ -498,7 +498,7 @@ class VyOSDriver(NetworkDriver):
|
|||||||
bgp_neighbor_data["global"]["peers"] = {}
|
bgp_neighbor_data["global"]["peers"] = {}
|
||||||
|
|
||||||
# delete the header and empty element
|
# delete the header and empty element
|
||||||
bgp_info = [i.strip() for i in output[6:-2] if i is not ""]
|
bgp_info = [i.strip() for i in output[6:-2] if i]
|
||||||
|
|
||||||
for i in bgp_info:
|
for i in bgp_info:
|
||||||
if len(i) > 0:
|
if len(i) > 0:
|
||||||
@@ -849,7 +849,7 @@ class VyOSDriver(NetworkDriver):
|
|||||||
else:
|
else:
|
||||||
err = ""
|
err = ""
|
||||||
|
|
||||||
if err is not "":
|
if err:
|
||||||
ping_result["error"] = err
|
ping_result["error"] = err
|
||||||
else:
|
else:
|
||||||
# 'packet_info' example:
|
# 'packet_info' example:
|
||||||
|
|||||||
Reference in New Issue
Block a user