Skip to content

Commit

Permalink
Fix LVHDSR.load: test other_conf to prevent mypy error
Browse files Browse the repository at this point in the history
Avoid:
```
drivers/LVHDSR.py:195: error: Item "None" of "Any | None" has no attribute "get"  [union-attr]
drivers/LVHDSR.py:196: error: Value of type "Any | None" is not indexable  [index]
```

Signed-off-by: Ronan Abhamon <[email protected]>
  • Loading branch information
Wescoeur committed Jan 8, 2025
1 parent 59ed5e3 commit 85b9b23
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/LVHDSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ def load(self, sr_uuid) -> None:
self.provision = self.PROVISIONING_DEFAULT

self.other_conf = None
has_sr_ref = self.srcmd.params.get("sr_ref")
if has_sr_ref:
if self.srcmd.params.get("sr_ref"):
self.other_conf = self.session.xenapi.SR.get_other_config(self.sr_ref)

self.lvm_conf = None
Expand All @@ -182,7 +181,7 @@ def load(self, sr_uuid) -> None:
opterr='Failed to initialise the LVMCache')
self.lvActivator = LVActivator(self.uuid, self.lvmCache)
self.journaler = Journaler(self.lvmCache)
if not has_sr_ref:
if not self.other_conf:
return # must be a probe call
# Test for thick vs thin provisioning conf parameter
if 'allocation' in self.dconf:
Expand Down

0 comments on commit 85b9b23

Please sign in to comment.