diff options
author | Devaev Maxim <[email protected]> | 2019-04-30 01:05:25 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-04-30 01:05:25 +0300 |
commit | fb9b1b555db20d3ddfa0618a7faba3ae2ec395e5 (patch) | |
tree | 9eed4095955d736c273bad9a0741c29d4e777dd7 | |
parent | 76bc1bcea68e4d53f869371e793ef72c7e2c5571 (diff) |
soft of by default
-rw-r--r-- | kvmd/apps/ipmi/server.py | 6 | ||||
-rw-r--r-- | kvmd/apps/kvmd/atx.py | 8 | ||||
-rw-r--r-- | kvmd/apps/kvmd/server.py | 4 | ||||
-rw-r--r-- | kvmd/validators/kvm.py | 2 | ||||
-rw-r--r-- | testenv/tests/validators/test_kvm.py | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/kvmd/apps/ipmi/server.py b/kvmd/apps/ipmi/server.py index f71ce85c..3bc2ed94 100644 --- a/kvmd/apps/ipmi/server.py +++ b/kvmd/apps/ipmi/server.py @@ -110,10 +110,10 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute def __chassis_control_handler(self, request: Dict, session: IpmiServerSession) -> None: handle = { - 0: "/atx/power?action=off", + 0: "/atx/power?action=off_hard", 1: "/atx/power?action=on", - 3: "/atx/power?action=reset", - 5: "/atx/power?action=off_soft", + 3: "/atx/power?action=reset_hard", + 5: "/atx/power?action=off", }.get(request["data"][0], "") if handle: if self.__make_request("POST", handle, session)[0] == 409: diff --git a/kvmd/apps/kvmd/atx.py b/kvmd/apps/kvmd/atx.py index 72269c23..07522fe8 100644 --- a/kvmd/apps/kvmd/atx.py +++ b/kvmd/apps/kvmd/atx.py @@ -137,19 +137,19 @@ class Atx: # pylint: disable=too-many-instance-attributes @_atx_working async def power_off(self) -> bool: if self.get_state()["leds"]["power"]: - await self.click_power_long() + await self.click_power() return True return False @_atx_working - async def power_off_soft(self) -> bool: + async def power_off_hard(self) -> bool: if self.get_state()["leds"]["power"]: - await self.click_power() + await self.click_power_long() return True return False @_atx_working - async def power_reset(self) -> bool: + async def power_reset_hard(self) -> bool: if self.get_state()["leds"]["power"]: await self.click_reset() return True diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index 5afddad1..2721189b 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -437,8 +437,8 @@ class Server: # pylint: disable=too-many-instance-attributes done = await ({ "on": self.__atx.power_on, "off": self.__atx.power_off, - "off_soft": self.__atx.power_off_soft, - "reset": self.__atx.power_reset, + "off_hard": self.__atx.power_off_hard, + "reset_hard": self.__atx.power_reset_hard, }[action])() return _json({"action": action, "done": done}) diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py index 09bd7c2b..170c0cc9 100644 --- a/kvmd/validators/kvm.py +++ b/kvmd/validators/kvm.py @@ -31,7 +31,7 @@ from .basic import valid_number # ===== def valid_atx_power_action(arg: Any) -> str: - return check_string_in_list(arg, "ATX power action", ["on", "off", "off_soft", "reset"]) + return check_string_in_list(arg, "ATX power action", ["on", "off", "off_hard", "reset_hard"]) def valid_atx_button(arg: Any) -> str: diff --git a/testenv/tests/validators/test_kvm.py b/testenv/tests/validators/test_kvm.py index cfdad69e..a15a3168 100644 --- a/testenv/tests/validators/test_kvm.py +++ b/testenv/tests/validators/test_kvm.py @@ -40,7 +40,7 @@ from kvmd.validators.kvm import valid_hid_mouse_wheel # ===== [email protected]("arg", ["ON ", "OFF ", "OFF_soft ", "RESET "]) [email protected]("arg", ["ON ", "OFF ", "OFF_HARD ", "RESET_HARD "]) def test_ok__valid_atx_power_action(arg: Any) -> None: assert valid_atx_power_action(arg) == arg.strip().lower() |