Remove else because of early return
This commit is contained in:
parent
035e4ce6ae
commit
c3e9bcc147
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user