Remove if-"hell" in adjust swappiness
This commit is contained in:
parent
d3e2c99198
commit
e573118b38
@ -104,29 +104,24 @@ class SwapModule(AbstractModule):
|
|||||||
subprocess.call(get_swapiness, shell=True)
|
subprocess.call(get_swapiness, shell=True)
|
||||||
|
|
||||||
def adjust_swapiness_temp(self):
|
def adjust_swapiness_temp(self):
|
||||||
actions = ["Light", "Default", "Aggressive"]
|
actions = {
|
||||||
|
"Light": 25,
|
||||||
|
"Default": 60,
|
||||||
|
"Aggressive": 100
|
||||||
|
}
|
||||||
menu = [
|
menu = [
|
||||||
{
|
{
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
'message': 'Select action',
|
'message': 'Select action',
|
||||||
'name': 'action',
|
'name': 'action',
|
||||||
'choices': list(map(lambda x: {"name": x}, actions))
|
'choices': list(map(lambda x: {"name": x}, actions.keys()))
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
selected_swapiness = prompt(menu)['action']
|
selected_swapiness = prompt(menu)['action']
|
||||||
|
|
||||||
if selected_swapiness == "Light":
|
adjust = "sudo sysctl vm.swappiness=" + str(actions[selected_swapiness])
|
||||||
adjust = "sudo sysctl vm.swappiness=25"
|
|
||||||
subprocess.call(adjust, shell=True)
|
subprocess.call(adjust, shell=True)
|
||||||
print("Temporary swapiness is 25")
|
print("Temporary swapiness is " + str(actions[selected_swapiness]))
|
||||||
elif selected_swapiness == "Default":
|
|
||||||
adjust = "sudo sysctl vm.swappiness=60"
|
|
||||||
subprocess.call(adjust, shell=True)
|
|
||||||
print("Temporary swapiness is 60")
|
|
||||||
elif selected_swapiness == "Aggressive":
|
|
||||||
adjust = "sudo sysctl vm.swappiness=100"
|
|
||||||
subprocess.call(adjust, shell=True)
|
|
||||||
print("Temporary swapiness is 100")
|
|
||||||
|
|
||||||
def delete_swap(self):
|
def delete_swap(self):
|
||||||
self.swap_location_check()
|
self.swap_location_check()
|
||||||
|
Loading…
Reference in New Issue
Block a user