diff --git a/modules/swap/module.py b/modules/swap/module.py index 7fb7827..f6a6838 100644 --- a/modules/swap/module.py +++ b/modules/swap/module.py @@ -83,13 +83,12 @@ class SwapModule(AbstractModule): def _make_swap_persistent(self): swap_location = self._get_swap_location() - persistence_entry = self._check_fstab_entry() if swap_location is None: print("Swap file doesn't exist!") return backup_fstab = "sudo cp /etc/fstab /etc/fstab.bak" enable_persistence = "echo '{} none swap sw 0 0' | sudo tee -a /etc/fstab".format(swap_location) - if persistence_entry is True: + if self._check_fstab_entry(): print("Swap is already persistent!") else: subprocess.call(backup_fstab, shell=True) @@ -126,7 +125,7 @@ class SwapModule(AbstractModule): return disable_swapfile = "sudo swapoff {} && ".format(swap_location) + \ "sudo rm {}".format(swap_location) - if self._check_fstab_entry() is True: + if self._check_fstab_entry(): with open("/etc/fstab", "r") as fstab_out: content = fstab_out.readlines() with open("/etc/fstab", "w") as fstab_in: