Issues with Network Management and user management in menu (#1036)
* A problem with default values treatment at superusers (and users) on the main menu * Solving issues when changing the selection of nic, ask_to_configure_network failed in several places. Solved, temporarily with the creation of __getitem__ and get methods at NetworkManager * Accept old style definitions for nic * flake8 complains * log string corrected (issue 1039) * Correct exit when no disk is selected and we don't wish to continue
This commit is contained in:
parent
69bd88a7f9
commit
e85c9b6531
|
|
@ -149,7 +149,7 @@ class Installer:
|
||||||
|
|
||||||
# We avoid printing /mnt/<log path> because that might confuse people if they note it down
|
# We avoid printing /mnt/<log path> because that might confuse people if they note it down
|
||||||
# and then reboot, and a identical log file will be found in the ISO medium anyway.
|
# and then reboot, and a identical log file will be found in the ISO medium anyway.
|
||||||
print(_("[!] A log file has been created here: {} {}").format(os.path.join(storage['LOG_PATH'], storage['LOG_FILE'])))
|
print(_("[!] A log file has been created here: {}").format(os.path.join(storage['LOG_PATH'], storage['LOG_FILE'])))
|
||||||
print(_(" Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues"))
|
print(_(" Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues"))
|
||||||
raise args[1]
|
raise args[1]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -502,6 +502,7 @@ class GlobalMenu(GeneralMenu):
|
||||||
_('Specify superuser account'),
|
_('Specify superuser account'),
|
||||||
lambda preset: self._create_superuser_account(),
|
lambda preset: self._create_superuser_account(),
|
||||||
exec_func=lambda n,v:self._users_resynch(),
|
exec_func=lambda n,v:self._users_resynch(),
|
||||||
|
default={},
|
||||||
dependencies_not=['!root-password'],
|
dependencies_not=['!root-password'],
|
||||||
display_func=lambda x: self._display_superusers())
|
display_func=lambda x: self._display_superusers())
|
||||||
self._menu_options['!users'] = \
|
self._menu_options['!users'] = \
|
||||||
|
|
@ -656,7 +657,7 @@ class GlobalMenu(GeneralMenu):
|
||||||
choice = Menu(prompt, ['yes', 'no'], default_option='yes').run()
|
choice = Menu(prompt, ['yes', 'no'], default_option='yes').run()
|
||||||
|
|
||||||
if choice == 'no':
|
if choice == 'no':
|
||||||
return self._select_harddrives()
|
exit(1)
|
||||||
|
|
||||||
return harddrives
|
return harddrives
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,32 @@ class NetworkConfiguration:
|
||||||
return self.__dict__
|
return self.__dict__
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse_arguments(cls, config: Dict[str, str]) -> Optional["NetworkConfiguration"]:
|
def parse_arguments(cls, config: Union[str,Dict[str, str]]) -> Optional["NetworkConfiguration"]:
|
||||||
nic_type = config.get('type', None)
|
nic_type = config.get('type', None)
|
||||||
|
|
||||||
if not nic_type:
|
if not nic_type:
|
||||||
return None
|
# old style definitions
|
||||||
|
if isinstance(config,str): # is a ISO network
|
||||||
|
return NetworkConfiguration(NicType.ISO)
|
||||||
|
elif config.get('NetworkManager'): # is a network manager configuration
|
||||||
|
return NetworkConfiguration(NicType.NM)
|
||||||
|
elif 'ip' in config:
|
||||||
|
return NetworkConfiguration(
|
||||||
|
NicType.MANUAL,
|
||||||
|
iface=config.get('nic', ''),
|
||||||
|
ip=config.get('ip'),
|
||||||
|
gateway=config.get('gateway', ''),
|
||||||
|
dns=config.get('dns', []),
|
||||||
|
dhcp=False
|
||||||
|
)
|
||||||
|
elif 'nic' in config:
|
||||||
|
return NetworkConfiguration(
|
||||||
|
NicType.MANUAL,
|
||||||
|
iface=config.get('nic', ''),
|
||||||
|
dhcp=True
|
||||||
|
)
|
||||||
|
else: # not recognized
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
type = NicType(nic_type)
|
type = NicType(nic_type)
|
||||||
|
|
@ -95,3 +116,24 @@ class NetworkConfiguration:
|
||||||
installation.configure_nic(self)
|
installation.configure_nic(self)
|
||||||
installation.enable_service('systemd-networkd')
|
installation.enable_service('systemd-networkd')
|
||||||
installation.enable_service('systemd-resolved')
|
installation.enable_service('systemd-resolved')
|
||||||
|
|
||||||
|
def get(self, key :str, default_value :Any = None) -> Any:
|
||||||
|
result = self.__getitem__(key)
|
||||||
|
if result is None:
|
||||||
|
return default_value
|
||||||
|
else:
|
||||||
|
return result
|
||||||
|
|
||||||
|
def __getitem__(self, key :str) -> Any:
|
||||||
|
if key == 'type':
|
||||||
|
return self.type
|
||||||
|
elif key == 'iface':
|
||||||
|
return self.iface
|
||||||
|
elif key == 'gateway':
|
||||||
|
return self.gateway
|
||||||
|
elif key == 'dns':
|
||||||
|
return self.dns
|
||||||
|
elif key == 'dhcp':
|
||||||
|
return self.dhcp
|
||||||
|
else:
|
||||||
|
raise KeyError(f"key {key} not available at NetworkConfiguration")
|
||||||
|
|
|
||||||
|
|
@ -185,11 +185,13 @@ def perform_installation(mountpoint):
|
||||||
if archinstall.arguments.get('profile', None):
|
if archinstall.arguments.get('profile', None):
|
||||||
installation.install_profile(archinstall.arguments.get('profile', None))
|
installation.install_profile(archinstall.arguments.get('profile', None))
|
||||||
|
|
||||||
for user, user_info in archinstall.arguments.get('!users', {}).items():
|
if archinstall.arguments.get('!users',{}):
|
||||||
installation.user_create(user, user_info["!password"], sudo=False)
|
for user, user_info in archinstall.arguments.get('!users', {}).items():
|
||||||
|
installation.user_create(user, user_info["!password"], sudo=False)
|
||||||
|
|
||||||
for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
|
if archinstall.arguments.get('!superusers',{}):
|
||||||
installation.user_create(superuser, user_info["!password"], sudo=True)
|
for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
|
||||||
|
installation.user_create(superuser, user_info["!password"], sudo=True)
|
||||||
|
|
||||||
if timezone := archinstall.arguments.get('timezone', None):
|
if timezone := archinstall.arguments.get('timezone', None):
|
||||||
installation.set_timezone(timezone)
|
installation.set_timezone(timezone)
|
||||||
|
|
|
||||||
|
|
@ -415,11 +415,13 @@ def os_setup(installation):
|
||||||
if archinstall.arguments.get('profile', None):
|
if archinstall.arguments.get('profile', None):
|
||||||
installation.install_profile(archinstall.arguments.get('profile', None))
|
installation.install_profile(archinstall.arguments.get('profile', None))
|
||||||
|
|
||||||
for user, user_info in archinstall.arguments.get('!users', {}).items():
|
if archinstall.arguments.get('!users',{}):
|
||||||
installation.user_create(user, user_info["!password"], sudo=False)
|
for user, user_info in archinstall.arguments.get('!users', {}).items():
|
||||||
|
installation.user_create(user, user_info["!password"], sudo=False)
|
||||||
|
|
||||||
for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
|
if archinstall.arguments.get('!superusers',{}):
|
||||||
installation.user_create(superuser, user_info["!password"], sudo=True)
|
for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
|
||||||
|
installation.user_create(superuser, user_info["!password"], sudo=True)
|
||||||
|
|
||||||
if timezone := archinstall.arguments.get('timezone', None):
|
if timezone := archinstall.arguments.get('timezone', None):
|
||||||
installation.set_timezone(timezone)
|
installation.set_timezone(timezone)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue