Python – Using IPMI inside a python script (OpenIPMI)

electrical-poweripminetbootpxe-bootpython

I'd like to use IPMI to set machines to PXE boot (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis bootdev pxe) and then power cycle them (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis power cycle). However, I'd like to do this in a python script so I'm trying to use OpenIPMI and its python bindings.

I can't seem to find any documentation on OpenIPMI for a python script and I'm not sure how to correctly apply IPMI commands (making sure the machine is in the right state so the commands don't fail). Can someone please show me some pointers or resources on using OpenIPMI (or an alternative) to operate IPMI commands in python? Thanks!

Best Answer

So while you're trying to figure out the IPMI bindings, why not write simple wrappers for the commandline ipmitool? Later you can figure out how to get the python bindings to work right and sub them in; for now, use subprocess.Popen() and friends.