Re-working top-level-profile lambda to be a parameter to list_profiles() instead. When skipping a profile, None is returned from somewhere and it causes a glitch. So trying to figure out where and what by cleaning up a bit

This commit is contained in:
Anton Hvornum 2021-04-21 14:37:23 +02:00
parent 8d9a542962
commit 46b872aa61
2 changed files with 7 additions and 2 deletions

View File

@ -15,7 +15,7 @@ def grab_url_data(path):
response = urllib.request.urlopen(safe_path, context=ssl_context)
return response.read()
def list_profiles(filter_irrelevant_macs=True, subpath=''):
def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_profiles=False):
# TODO: Grab from github page as well, not just local static files
if filter_irrelevant_macs:
local_macs = list_interfaces()
@ -63,6 +63,11 @@ def list_profiles(filter_irrelevant_macs=True, subpath=''):
cache[profile[:-3]] = {'path' : os.path.join(storage["UPSTREAM_URL"]+subpath, profile), 'description' : profile_list[profile], 'tailored' : tailored}
if filter_top_level_profiles:
for profile in list(cache.keys()):
if Profile(None, profile).is_top_level_profile() is False:
del(cache[profile])
return cache
class Script():

View File

@ -164,7 +164,7 @@ def ask_user_questions():
# Ask for archinstall-specific profiles (such as desktop environments etc)
if not archinstall.arguments.get('profile', None):
archinstall.arguments['profile'] = archinstall.select_profile(filter(lambda profile: (Profile(None, profile).is_top_level_profile()), archinstall.list_profiles()))
archinstall.arguments['profile'] = archinstall.select_profile(archinstall.list_profiles(filter_top_level_profiles=True))
else:
archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']]