Skip to content

Commit

Permalink
fix(Server): Show reboot_with_serial_console option for AWS only
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurali27 committed Nov 27, 2024
1 parent 0447082 commit 6708388
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion press/press/doctype/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ frappe.ui.form.on('Server', {
__('Reboot with serial console'),
'reboot_with_serial_console',
true,
frm.doc.virtual_machine,
frm.doc.provider === 'AWS EC2',
],
[
__('Enable Public Bench and Site Creation'),
Expand Down
19 changes: 10 additions & 9 deletions press/press/doctype/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,15 +919,16 @@ def real_ram(self):

@frappe.whitelist()
def reboot_with_serial_console(self):
if self.provider in ("AWS EC2",):
console = frappe.new_doc("Serial Console Log")
console.server_type = self.doctype
console.server = self.name
console.virtual_machine = self.virtual_machine
console.action = "reboot"
console.save()
console.reload()
console.run_sysrq()
if self.provider != "AWS EC2":
raise NotImplementedError
console = frappe.new_doc("Serial Console Log")
console.server_type = self.doctype
console.server = self.name
console.virtual_machine = self.virtual_machine
console.action = "reboot"
console.save()
console.reload()
console.run_sysrq()

@dashboard_whitelist()
def reboot(self):
Expand Down

0 comments on commit 6708388

Please sign in to comment.