Improve SyntaxWarning for empty string checks

This commit is contained in:
Brad Walker 2020-05-16 10:31:22 -06:00
parent b287f3d6c7
commit 3b53afd852
1 changed files with 3 additions and 3 deletions

View File

@ -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: