Skip to content

Commit

Permalink
Set default value for partition available parameter
Browse files Browse the repository at this point in the history
While testing NFS storage pool with invalid host and path, partition
information will be empty and it was raising an exception. Fix it by
adding a default value for partition 'available' parameter.

Signed-off-by: Aline Manera <[email protected]>
  • Loading branch information
alinefm committed Jan 8, 2020
1 parent f2299e7 commit 960b0d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions control/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, model):
# sorted by their path
def _get_resources(self, flag_filter):
res_list = super(Partitions, self)._get_resources(flag_filter)
res_list = list(filter(lambda x: x.info['available'], res_list))
res_list = list(filter(lambda x: x.info.get('available', False), res_list))
if is_s390x():
# On s390x arch filter out the DASD block devices which
# don't have any partition(s). This is necessary because
Expand All @@ -123,7 +123,7 @@ def __init__(self, model, id):

@property
def data(self):
if not self.info['available']:
if not self.info.get('available', False):
raise NotFoundError('KCHPART0001E', {'name': self.info['name']})

return self.info

0 comments on commit 960b0d1

Please sign in to comment.