Skip to content

Commit

Permalink
Merge 8d88011 into 246c4e8
Browse files Browse the repository at this point in the history
  • Loading branch information
vali-um committed Jun 5, 2024
2 parents 246c4e8 + 8d88011 commit dee380d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyipmi/interfaces/ipmitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ class Ipmitool(object):
IPMITOOL_PATH = 'ipmitool'
supported_interfaces = ['lan', 'lanplus', 'serial-terminal', 'open']

def __init__(self, interface_type='lan'):
def __init__(self, interface_type='lan', cipher=None):
if interface_type in self.supported_interfaces:
self._interface_type = interface_type
else:
raise RuntimeError('interface type %s not supported' %
interface_type)
if cipher is not None and int(cipher) not in range(0,255):
raise RuntimeError('cipher %s not in allowed range [0-255]' %
cipher)
else:
self._cipher = cipher

self.re_completion_code = re.compile(
r"Unable to send RAW command \(.*rsp=(0x[0-9a-f]+)\)")
Expand Down Expand Up @@ -233,6 +238,8 @@ def _build_ipmitool_cmd(self, target, lun, netfn, raw_bytes):

cmd += self._build_ipmitool_priv_level(self._session.priv_level)

if self._cipher:
cmd += (' -C %s' % self._cipher)
if self._session.auth_type == Session.AUTH_TYPE_NONE:
cmd += ' -P ""'
elif self._session.auth_type == Session.AUTH_TYPE_PASSWORD:
Expand Down
3 changes: 3 additions & 0 deletions pyipmi/ipmitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def usage(toplevel=False):
Ipmitool interface options:
interface_type Set the interface type to be used (lan, lanplus, serial, open)
cipher Set the cipher to be used (0-255)
Ipmbdev interface options:
port=<path> Specify path to Linux IPMB device (/dev/ipmb-0 by default)
Expand Down Expand Up @@ -533,6 +534,8 @@ def parse_interface_options(interface_name, options):
elif interface_name == 'ipmitool':
if name == 'interface_type':
interface_options['interface_type'] = value
elif name == 'cipher':
interface_options['cipher'] = value
else:
print('Warning: unknown option %s' % name)
elif interface_name == 'ipmbdev':
Expand Down

0 comments on commit dee380d

Please sign in to comment.