Skip to content

Commit

Permalink
fix: convert filter to list for compatibility with Python 3
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Styk <[email protected]>
  • Loading branch information
StykMartin committed Oct 28, 2024
1 parent 2143d1f commit 1032dd0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions LabController/src/bkr/labcontroller/distro_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def get_os_dir(self, arch):
"""
base_path = os.path.join(self.parser.url, arch)
try:
os_dir = filter(lambda x: url_exists(os.path.join(base_path, x)) \
and x, self.os_dirs)[0]
os_dir = list(filter(lambda x: url_exists(os.path.join(base_path, x)) and x,
self.os_dirs))[0]
except IndexError as e:
raise BX('%s no os_dir found: %s' % (base_path, e))
return os.path.join(arch, os_dir)
Expand Down Expand Up @@ -1035,15 +1035,15 @@ def is_importer_for(cls, url, options=None):

def get_kernel_path(self):
try:
return filter(lambda x: url_exists(os.path.join(self.parser.url,x)) \
and x, [kernel for kernel in self.kernels])[0]
return list(filter(lambda x: url_exists(os.path.join(self.parser.url,x)) and x,
[kernel for kernel in self.kernels]))[0]
except IndexError as e:
raise BX('%s no kernel found: %s' % (self.parser.url, e))

def get_initrd_path(self):
try:
return filter(lambda x: url_exists(os.path.join(self.parser.url,x)) \
and x, [initrd for initrd in self.initrds])[0]
return list(filter(lambda x: url_exists(os.path.join(self.parser.url,x)) and x,
[initrd for initrd in self.initrds]))[0]
except IndexError as e:
raise BX('%s no kernel found: %s' % (self.parser.url, e))

Expand Down

0 comments on commit 1032dd0

Please sign in to comment.