Avoid None Return
This commit is contained in:
parent
969663b8bf
commit
5178fa54c1
|
|
@ -8,10 +8,15 @@ from archinstall.lib.translationhandler import tr
|
||||||
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
||||||
from archinstall.tui.result import ResultType
|
from archinstall.tui.result import ResultType
|
||||||
|
|
||||||
async def confirm_ufw(config: ArchConfig) -> None:
|
async def confirm_ufw(config: ArchConfig) -> bool:
|
||||||
firewall_config = config.app_config.firewall_config
|
firewall_config = config.app_config.firewall_config
|
||||||
is_ufw = firewall_config and firewall_config.firewall and firewall_config.firewall.value == 'ufw'
|
is_ufw = firewall_config and firewall_config.firewall and firewall_config.firewall.value == 'ufw'
|
||||||
if is_ufw and "openssh" in config.packages:
|
has_openssh = "openssh" in config.packages
|
||||||
|
|
||||||
|
if not (is_ufw and has_openssh):
|
||||||
|
return True
|
||||||
|
|
||||||
|
else:
|
||||||
header = f'{tr("You have both ufw and OpenSSH in your packages")}. '
|
header = f'{tr("You have both ufw and OpenSSH in your packages")}. '
|
||||||
header += tr('Would you like to allow incoming SSH connections through the firewall?') + '\n'
|
header += tr('Would you like to allow incoming SSH connections through the firewall?') + '\n'
|
||||||
group = MenuItemGroup.yes_no()
|
group = MenuItemGroup.yes_no()
|
||||||
|
|
@ -23,9 +28,11 @@ async def confirm_ufw(config: ArchConfig) -> None:
|
||||||
preset=True,
|
preset=True,
|
||||||
).show()
|
).show()
|
||||||
|
|
||||||
if result:
|
if result and result.get_value():
|
||||||
config.custom_commands.append("ufw allow OpenSSH")
|
config.custom_commands.append("ufw allow OpenSSH")
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
async def confirm_config(config: ArchConfig) -> bool:
|
async def confirm_config(config: ArchConfig) -> bool:
|
||||||
header = f'{tr("The specified configuration will be applied")}. '
|
header = f'{tr("The specified configuration will be applied")}. '
|
||||||
header += tr('Would you like to continue?') + '\n'
|
header += tr('Would you like to continue?') + '\n'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue