Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-09-14 20:05:05 +1000
committerGitHub <noreply@github.com>2023-09-14 20:05:05 +1000
commitdcf3dfef57999d4e13ed83a75e52704cf44d8075 (patch)
treeb8379663907e092e0fe266c96e2df1c31978e429 /archinstall/lib
parentc8e0b9a4d685b941e3b406bc6f8ecfaef60e1f5f (diff)
Fix 2035 - Profile configuration (#2036)
Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/profile/profile_model.py4
-rw-r--r--archinstall/lib/profile/profiles_handler.py33
2 files changed, 18 insertions, 19 deletions
diff --git a/archinstall/lib/profile/profile_model.py b/archinstall/lib/profile/profile_model.py
index 2b52073a..8c955733 100644
--- a/archinstall/lib/profile/profile_model.py
+++ b/archinstall/lib/profile/profile_model.py
@@ -27,11 +27,13 @@ class ProfileConfiguration:
@classmethod
def parse_arg(cls, arg: Dict[str, Any]) -> 'ProfileConfiguration':
from .profiles_handler import profile_handler
+
+ profile = profile_handler.parse_profile_config(arg['profile'])
greeter = arg.get('greeter', None)
gfx_driver = arg.get('gfx_driver', None)
return ProfileConfiguration(
- profile_handler.parse_profile_config(arg['profile']),
+ profile,
GfxDriver(gfx_driver) if gfx_driver else None,
GreeterType(greeter) if greeter else None
)
diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py
index 74c21824..7e6af3d1 100644
--- a/archinstall/lib/profile/profiles_handler.py
+++ b/archinstall/lib/profile/profiles_handler.py
@@ -52,9 +52,9 @@ class ProfileHandler:
def parse_profile_config(self, profile_config: Dict[str, Any]) -> Optional[Profile]:
"""
- Deserialize JSON configuration
+ Deserialize JSON configuration for profile
"""
- profile = None
+ profile: Optional[Profile] = None
# the order of these is important, we want to
# load all the default_profiles from url and custom
@@ -97,29 +97,26 @@ class ProfileHandler:
if main := profile_config.get('main', None):
profile = self.get_profile_by_name(main) if main else None
- valid: List[Profile] = []
+ if not profile:
+ return None
+
+ valid_sub_profiles: List[Profile] = []
+ invalid_sub_profiles: List[str] = []
details: List[str] = profile_config.get('details', [])
- if details:
- valid = []
- invalid = []
+ if details:
for detail in filter(None, details):
- if profile := self.get_profile_by_name(detail):
- valid.append(profile)
+ if sub_profile := self.get_profile_by_name(detail):
+ valid_sub_profiles.append(sub_profile)
else:
- invalid.append(detail)
+ invalid_sub_profiles.append(detail)
- if invalid:
- info('No profile definition found: {}'.format(', '.join(invalid)))
+ if invalid_sub_profiles:
+ info('No profile definition found: {}'.format(', '.join(invalid_sub_profiles)))
custom_settings = profile_config.get('custom_settings', {})
- for profile in valid:
- profile.set_custom_settings(
- custom_settings.get(profile.name, {})
- )
-
- if profile is not None:
- profile.set_current_selection(valid)
+ profile.set_custom_settings(custom_settings)
+ profile.set_current_selection(valid_sub_profiles)
return profile