BugFix: output=all results in exception
This commit is contained in:
parent
587de798c2
commit
7bc7c42d7f
11
powerplug.py
11
powerplug.py
@ -35,13 +35,16 @@ class sispmctl(object):
|
||||
return output
|
||||
|
||||
def set_out_state(self, output, state):
|
||||
output = self.__filter_output_parameter__(output)
|
||||
if output == "all":
|
||||
state = [state, state, state, state]
|
||||
if self.__state__ != [state, state, state, state]:
|
||||
self.__set_out_state__(output, state)
|
||||
else:
|
||||
if self.__state__[int(output) - 1] != state:
|
||||
self.__set_out_state__(output, state)
|
||||
|
||||
if self.__state__[output - 1] != state:
|
||||
def __set_out_state__(self, output, state):
|
||||
try:
|
||||
out_txt = subprocess.check_output(["sudo", "sispmctl", "-o" if state == True or state == [True, True, True, True] else "-f", str(output)]).decode('UTF-8')
|
||||
out_txt = subprocess.check_output(["sudo", "sispmctl", "-o" if state == True else "-f", output]).decode('UTF-8')
|
||||
except subprocess.CalledProcessError as grepexc:
|
||||
logger.error("sispm error code %d", grepexc.returncode)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user