Remove else because of early return

This commit is contained in:
Lucas Noki 2020-01-25 02:12:10 +01:00
parent 035e4ce6ae
commit c3e9bcc147

View File

@ -117,13 +117,12 @@ class SwapModule(AbstractModule):
self._swap_location_check()
if self.swap_file is None:
return
else:
disable_swapfile = "sudo swapoff {} && ".format(self.swap_file) + \
"sudo rm {}".format(self.swap_file)
disable_swapfile = "sudo swapoff {} && ".format(self.swap_file) + \
"sudo rm {}".format(self.swap_file)
subprocess.call(disable_swapfile, shell=True)
output_swapon = subprocess.check_output(['swapon', '--show']).decode("UTF-8")
output_free = subprocess.check_output(['free', '-h']).decode("UTF-8")
if not output_swapon:
print("Swap deleted!")
print(output_free.strip())
subprocess.call(disable_swapfile, shell=True)
output_swapon = subprocess.check_output(['swapon', '--show']).decode("UTF-8")
output_free = subprocess.check_output(['free', '-h']).decode("UTF-8")
if not output_swapon:
print("Swap deleted!")
print(output_free.strip())