1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmdbusd: Check for KeyError in refresh

Bubble up a LvmBug if we get a KeyError on a lvm column name.
This commit is contained in:
Tony Asleson 2022-09-08 15:39:30 -05:00
parent feaf46863b
commit d51fb57f1a

View File

@ -15,7 +15,7 @@ import pprint as prettyprint
import os
from lvmdbusd import cmdhandler
from lvmdbusd.utils import log_debug, log_error
from lvmdbusd.utils import log_debug, log_error, lvm_column_key, LvmBug
class DataStore(object):
@ -309,6 +309,7 @@ class DataStore(object):
:param log Add debug log entry/exit messages
:return: None
"""
try:
self.num_refreshes += 1
if log:
log_debug("lvmdb - refresh entry")
@ -335,6 +336,11 @@ class DataStore(object):
# Create lookup table for which LV and segments are on each PV
self.pv_lvs, self.lv_pvs = self._parse_pv_in_lvs()
except KeyError as ke:
key = ke.args[0]
if lvm_column_key(key):
raise LvmBug("missing JSON key: '%s'" % key)
raise ke
if log:
log_debug("lvmdb - refresh exit")