Skip to content

Commit 2d07539

Browse files
Fix reboot
1 parent eaaa571 commit 2d07539

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extensions/MaaS/maas.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import sys
2020
import json
21+
import time
2122
from requests_oauthlib import OAuth1Session
2223

2324

@@ -200,8 +201,12 @@ def reboot(self):
200201
sysid = self.data.get("system_id")
201202
if not sysid:
202203
fail("system_id missing for reboot")
203-
self.call_maas("POST", f"/machines/{sysid}/", {"op": "power_cycle"})
204-
succeed({"status": "success", "power_state": "PowerOn"})
204+
205+
self.call_maas("POST", f"/machines/{sysid}/", {"op": "power_off"})
206+
time.sleep(5)
207+
self.call_maas("POST", f"/machines/{sysid}/", {"op": "power_on"})
208+
209+
succeed({"status": "success", "power_state": "PowerOn", "message": "Reboot completed"})
205210

206211
def status(self):
207212
sysid = self.data.get("system_id")

0 commit comments

Comments
 (0)