Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trid: Fix migration of old TID object (introspect self._cfg member) #367

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# STorage Appliance Services (STAS)

## Changes with release 2.2.2

Bug fixes:

* Fix migration of old "last known config" to new format. Old TID objects did not contain a `_cfg` member. Therefore, one needs to check for its existence (through introspection) before blindly trying to access it.

## Changes with release 2.2.1

Added a few more unit and coverage tests. Fixed the following bugs.
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project(
'nvme-stas',
meson_version: '>= 0.53.0',
version: '2.2.1',
version: '2.2.2',
license: 'Apache-2.0',
default_options: [
'buildtype=release',
Expand Down
7 changes: 6 additions & 1 deletion staslib/trid.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def as_dict(self):
'host-traddr': self.host_traddr,
'host-iface': self.host_iface,
}
data.update(self._cfg)

# When migrating an old last known config, the "_cfg" member may
# not exist. Therefor retrive it with getattr() to avoid a crash.
cfg = getattr(self, '_cfg', None)
if cfg:
data.update(cfg)
return data

def __str__(self):
Expand Down