Skip to content

Commit

Permalink
fix: rest init code to master and fix PEP8 issue
Browse files Browse the repository at this point in the history
Signed-off-by: Evloev Sayfuddin <[email protected]>
  • Loading branch information
FrenkenFlores committed Jan 7, 2025
1 parent 6a7a664 commit 3ffed98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
8 changes: 0 additions & 8 deletions pyipmi/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 2 additions & 6 deletions pyipmi/interfaces/ipmitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pyipmi/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down

0 comments on commit 3ffed98

Please sign in to comment.