Skip to content

Commit 3ffed98

Browse files
committed
fix: rest init code to master and fix PEP8 issue
Signed-off-by: Evloev Sayfuddin <evloev.sayfuddin@wb.ru>
1 parent 6a7a664 commit 3ffed98

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

pyipmi/errors.py

-8
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,3 @@ def __init__(self, msg=None):
9090

9191
def __str__(self):
9292
return "{}".format(self.msg)
93-
94-
class IpmiLongPasswordError(Exception):
95-
"""Password longer than 20 bytes."""
96-
def __init__(self, msg=None):
97-
self.msg = msg
98-
99-
def __str__(self):
100-
return "{}".format(self.msg)

pyipmi/interfaces/ipmitool.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from array import array
2222

2323
from ..session import Session
24-
from ..errors import IpmiTimeoutError, IpmiConnectionError, IpmiLongPasswordError
24+
from ..errors import IpmiTimeoutError, IpmiConnectionError
2525
from ..logger import log
2626
from ..msgs import encode_message, decode_message, create_message
2727
from ..msgs.constants import CC_OK
@@ -62,8 +62,7 @@ def __init__(self, interface_type='lan', cipher=None):
6262
r".*Unable to establish.*")
6363
self.re_could_not_open = re.compile(
6464
r".*Could not open device.*")
65-
self.re_long_password = re.compile(
66-
r".*password is longer than.*")
65+
6766
self._session = None
6867

6968
def open(self):
@@ -136,9 +135,6 @@ def _parse_output(self, output):
136135
if self.re_could_not_open.match(line):
137136
raise RuntimeError('ipmitool failed: {}'.format(output))
138137

139-
if self.re_long_password.match(line):
140-
raise IpmiLongPasswordError(line)
141-
142138
hexstr += line.replace('\r', '').strip() + ' '
143139

144140
hexstr = hexstr.strip()

pyipmi/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _escape_dollar_sign(self, password):
118118
# The IPMI command is built and executed in a shell using Popen.
119119
# The '$_' combination has its own behavior in shell and it gets
120120
# replaced in the string.
121-
return password.replace('$', '\$')
121+
return password.replace('$', '\\$')
122122

123123
def establish(self):
124124
if hasattr(self.interface, 'establish_session'):

0 commit comments

Comments
 (0)