|
|
d7eb2d |
From b10c921a2d3bf2b84531ee7303a494919de67ae5 Mon Sep 17 00:00:00 2001
|
|
|
d7eb2d |
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
d7eb2d |
Date: Fri, 1 Jun 2018 14:05:14 +0530
|
|
|
d7eb2d |
Subject: [PATCH] saveconfig: handle no attr exception in _parse_info()
|
|
|
d7eb2d |
|
|
|
d7eb2d |
$ targetcli / saveconfig
|
|
|
d7eb2d |
'NoneType' object has no attribute 'group'
|
|
|
d7eb2d |
|
|
|
d7eb2d |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
d7eb2d |
---
|
|
|
d7eb2d |
rtslib/tcm.py | 14 ++++++++++----
|
|
|
d7eb2d |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
d7eb2d |
|
|
|
d7eb2d |
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
|
|
|
d7eb2d |
index 4feb738..4ed96b4 100644
|
|
|
d7eb2d |
--- a/rtslib/tcm.py
|
|
|
d7eb2d |
+++ b/rtslib/tcm.py
|
|
|
d7eb2d |
@@ -184,8 +184,11 @@ class StorageObject(CFSNode):
|
|
|
d7eb2d |
def _parse_info(self, key):
|
|
|
d7eb2d |
self._check_self()
|
|
|
d7eb2d |
info = fread("%s/info" % self.path)
|
|
|
d7eb2d |
- return re.search(".*%s: ([^: ]+).*" \
|
|
|
d7eb2d |
- % key, ' '.join(info.split())).group(1)
|
|
|
d7eb2d |
+ try:
|
|
|
d7eb2d |
+ return re.search(".*%s: ([^: ]+).*" \
|
|
|
d7eb2d |
+ % key, ' '.join(info.split())).group(1)
|
|
|
d7eb2d |
+ except AttributeError:
|
|
|
d7eb2d |
+ return None
|
|
|
d7eb2d |
|
|
|
d7eb2d |
def _get_status(self):
|
|
|
d7eb2d |
self._check_self()
|
|
|
d7eb2d |
@@ -994,8 +997,11 @@ class _Backstore(CFSNode):
|
|
|
d7eb2d |
def _parse_info(self, key):
|
|
|
d7eb2d |
self._check_self()
|
|
|
d7eb2d |
info = fread("%s/hba_info" % self.path)
|
|
|
d7eb2d |
- return re.search(".*%s: ([^: ]+).*" \
|
|
|
d7eb2d |
- % key, ' '.join(info.split())).group(1)
|
|
|
d7eb2d |
+ try:
|
|
|
d7eb2d |
+ return re.search(".*%s: ([^: ]+).*" \
|
|
|
d7eb2d |
+ % key, ' '.join(info.split())).group(1)
|
|
|
d7eb2d |
+ except AttributeError:
|
|
|
d7eb2d |
+ return None
|
|
|
d7eb2d |
|
|
|
d7eb2d |
def _get_version(self):
|
|
|
d7eb2d |
self._check_self()
|
|
|
d7eb2d |
--
|
|
|
d7eb2d |
1.8.3.1
|
|
|
d7eb2d |
|