Refactor IPMI command execution in server.py
This commit is contained in:
parent
686739eda4
commit
d089e0209d
2 changed files with 5 additions and 15 deletions
|
@ -1,14 +0,0 @@
|
|||
import subprocess
|
||||
|
||||
# Server IPMI details
|
||||
IPMIHOST = "192.168.1.223"
|
||||
IPMIUSER = "root"
|
||||
IPMIPASS = "<password>"
|
||||
|
||||
def execute_ipmi_command(command):
|
||||
full_command = f"ipmitool -I lanplus -H {IPMIHOST} -U {IPMIUSER} -P {IPMIPASS} {command}"
|
||||
print(f"Executing command: {full_command}") # Print the full command to debug
|
||||
result = subprocess.run(full_command, shell=True, capture_output=True, text=True)
|
||||
print(result.stdout)
|
||||
if result.stderr:
|
||||
print(result.stderr)
|
|
@ -8,7 +8,11 @@ IPMIPASS = "<password>"
|
|||
|
||||
def execute_ipmi_command(command):
|
||||
full_command = f"ipmitool -I lanplus -H {IPMIHOST} -U {IPMIUSER} -P {IPMIPASS} {command}"
|
||||
subprocess.run(full_command, shell=True)
|
||||
print(f"Executing command: {full_command}") # Print the full command to debug
|
||||
result = subprocess.run(full_command, shell=True, capture_output=True, text=True)
|
||||
print(result.stdout)
|
||||
if result.stderr:
|
||||
print(result.stderr)
|
||||
|
||||
def power_on():
|
||||
print("Powering on the server...")
|
||||
|
|
Loading…
Reference in a new issue