mirror of
https://opendev.org/x/pyghmi
synced 2025-01-13 11:17:47 +00:00
7371a58aba
It has been expressed as a concern that 'ipmi' is too generic a name. Additionally, it is also the case that non-ipmi capability is likely to be incorporated as it goes along (e.g. Enclosure management and virtual media are frequently not IPMI based). Move existing content under the 'pyghmi' namespace. pyghmi stands for 'python general hardware management infrastructure' and is pronounced 'pygmy' Change-Id: Ib549a9f5b7dd549c7dc5ddbab251a2e06c572e41
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
@author: Jarrod Johnson <jbjohnso@us.ibm.com>
|
|
|
|
Copyright 2013 IBM Corporation
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
"""
|
|
"""A simple little script to exemplify/test ipmi.console module
|
|
"""
|
|
import os
|
|
import sys
|
|
import termios
|
|
import tty
|
|
|
|
from pyghmi.ipmi import console
|
|
|
|
tcattr = termios.tcgetattr(sys.stdin)
|
|
newtcattr = tcattr
|
|
#TODO(jbjohnso): add our exit handler
|
|
newtcattr[-1][termios.VINTR] = 0
|
|
newtcattr[-1][termios.VSUSP] = 0
|
|
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, newtcattr)
|
|
|
|
tty.setcbreak(sys.stdin.fileno())
|
|
|
|
passwd = os.environ['IPMIPASSWORD']
|
|
|
|
try:
|
|
sol = console.Console(bmc=sys.argv[1], userid=sys.argv[2], password=passwd,
|
|
iohandler=(sys.stdin, sys.stdout), force=True)
|
|
sol.main_loop()
|
|
finally:
|
|
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, tcattr)
|