diff --git a/pyipmi/errors.py b/pyipmi/errors.py index 79bc80e..828a17d 100644 --- a/pyipmi/errors.py +++ b/pyipmi/errors.py @@ -90,11 +90,3 @@ def __init__(self, msg=None): def __str__(self): return "{}".format(self.msg) - -class IpmiLongPasswordError(Exception): - """Password longer than 20 bytes.""" - def __init__(self, msg=None): - self.msg = msg - - def __str__(self): - return "{}".format(self.msg) diff --git a/pyipmi/interfaces/ipmitool.py b/pyipmi/interfaces/ipmitool.py index 815041a..f2c1b54 100644 --- a/pyipmi/interfaces/ipmitool.py +++ b/pyipmi/interfaces/ipmitool.py @@ -21,7 +21,7 @@ from array import array from ..session import Session -from ..errors import IpmiTimeoutError, IpmiConnectionError, IpmiLongPasswordError +from ..errors import IpmiTimeoutError, IpmiConnectionError from ..logger import log from ..msgs import encode_message, decode_message, create_message from ..msgs.constants import CC_OK @@ -62,8 +62,7 @@ def __init__(self, interface_type='lan', cipher=None): r".*Unable to establish.*") self.re_could_not_open = re.compile( r".*Could not open device.*") - self.re_long_password = re.compile( - r".*password is longer than.*") + self._session = None def open(self): @@ -136,9 +135,6 @@ def _parse_output(self, output): if self.re_could_not_open.match(line): raise RuntimeError('ipmitool failed: {}'.format(output)) - if self.re_long_password.match(line): - raise IpmiLongPasswordError(line) - hexstr += line.replace('\r', '').strip() + ' ' hexstr = hexstr.strip() diff --git a/pyipmi/session.py b/pyipmi/session.py index 87091bf..bcdd51b 100644 --- a/pyipmi/session.py +++ b/pyipmi/session.py @@ -118,7 +118,7 @@ def _escape_dollar_sign(self, password): # The IPMI command is built and executed in a shell using Popen. # The '$_' combination has its own behavior in shell and it gets # replaced in the string. - return password.replace('$', '\$') + return password.replace('$', '\\$') def establish(self): if hasattr(self.interface, 'establish_session'):