Revision 8bb2df7d lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2027 | 2027 |
""" |
2028 | 2028 |
ltype = kwargs.get(self.ETYPE_FIELD, self.ETYPE_ERROR) |
2029 | 2029 |
itype, etxt, _ = ecode |
2030 |
# If the error code is in the list of ignored errors, demote the error to a |
|
2031 |
# warning |
|
2032 |
if etxt in self.op.ignore_errors: # pylint: disable=E1101 |
|
2033 |
ltype = self.ETYPE_WARNING |
|
2030 | 2034 |
# first complete the msg |
2031 | 2035 |
if args: |
2032 | 2036 |
msg = msg % args |
... | ... | |
2041 | 2045 |
msg = "%s: %s%s: %s" % (ltype, itype, item, msg) |
2042 | 2046 |
# and finally report it via the feedback_fn |
2043 | 2047 |
self._feedback_fn(" - %s" % msg) # Mix-in. pylint: disable=E1101 |
2048 |
# do not mark the operation as failed for WARN cases only |
|
2049 |
if ltype == self.ETYPE_ERROR: |
|
2050 |
self.bad = True |
|
2044 | 2051 |
|
2045 |
def _ErrorIf(self, cond, ecode, *args, **kwargs):
|
|
2052 |
def _ErrorIf(self, cond, *args, **kwargs): |
|
2046 | 2053 |
"""Log an error message if the passed condition is True. |
2047 | 2054 |
|
2048 | 2055 |
""" |
2049 |
cond = (bool(cond) |
|
2050 |
or self.op.debug_simulate_errors) # pylint: disable=E1101 |
|
2051 |
|
|
2052 |
# If the error code is in the list of ignored errors, demote the error to a |
|
2053 |
# warning |
|
2054 |
(_, etxt, _) = ecode |
|
2055 |
if etxt in self.op.ignore_errors: # pylint: disable=E1101 |
|
2056 |
kwargs[self.ETYPE_FIELD] = self.ETYPE_WARNING |
|
2057 |
|
|
2058 |
if cond: |
|
2059 |
self._Error(ecode, *args, **kwargs) |
|
2060 |
|
|
2061 |
# do not mark the operation as failed for WARN cases only |
|
2062 |
if kwargs.get(self.ETYPE_FIELD, self.ETYPE_ERROR) == self.ETYPE_ERROR: |
|
2063 |
self.bad = self.bad or cond |
|
2056 |
if (bool(cond) |
|
2057 |
or self.op.debug_simulate_errors): # pylint: disable=E1101 |
|
2058 |
self._Error(*args, **kwargs) |
|
2064 | 2059 |
|
2065 | 2060 |
|
2066 | 2061 |
class LUClusterVerify(NoHooksLU): |
Also available in: Unified diff