Skip to content

Commit

Permalink
fix(SerialConsoleLog): Run sysrq command at front
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurali27 committed Dec 9, 2024
1 parent 5f66677 commit 439b70b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions press/press/doctype/serial_console_log/serial_console_log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2023, Frappe and contributors
# For license information, please see license.txt

from __future__ import annotations

import time
from io import StringIO

Expand Down Expand Up @@ -60,13 +62,12 @@ def run_sysrq(self):
method="_run_sysrq",
queue="long",
enqueue_after_commit=True,
at_front=True,
)
frappe.db.commit()

def _run_sysrq(self):
credentials = frappe.get_doc(
"Virtual Machine", self.virtual_machine
).get_serial_console_credentials()
credentials = frappe.get_doc("Virtual Machine", self.virtual_machine).get_serial_console_credentials()
ssh = pexpect.spawn(credentials["command"], encoding="utf-8")
ssh.logfile = FakeIO(self)

Expand Down Expand Up @@ -116,9 +117,7 @@ def __init__(self, serial_console_log, *args, **kwargs):
def flush(self):
super().flush()
output = ansi_escape(self.getvalue())
frappe.db.set_value(
"Serial Console Log", self.console, "output", output, update_modified=False
)
frappe.db.set_value("Serial Console Log", self.console, "output", output, update_modified=False)

message = {"name": self.console, "output": output}
frappe.publish_realtime(
Expand Down

0 comments on commit 439b70b

Please sign in to comment.