one-off format of long lines with black

This commit is contained in:
Dan Bungert 2023-07-25 15:27:30 -06:00
parent 34d40643ad
commit c08fdab2f8
38 changed files with 89 additions and 97 deletions

View File

@ -27,7 +27,7 @@ from subiquitycore.log import setup_logger
def parse_options(argv): def parse_options(argv):
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=("console-conf - Pre-Ownership Configuration for Ubuntu Core"), description="console-conf - Pre-Ownership Configuration for Ubuntu Core",
prog="console-conf", prog="console-conf",
) )
parser.add_argument( parser.add_argument(

View File

@ -93,7 +93,7 @@ class ChooserCurrentSystemView(ChooserBaseView):
class ChooserView(ChooserBaseView): class ChooserView(ChooserBaseView):
excerpt = ( excerpt = (
"Select one of available recovery systems and a desired " "action to execute." "Select one of available recovery systems and a desired action to execute."
) )
def __init__(self, controller, systems): def __init__(self, controller, systems):
@ -173,7 +173,7 @@ class ChooserView(ChooserBaseView):
class ChooserConfirmView(ChooserBaseView): class ChooserConfirmView(ChooserBaseView):
canned_summary = { canned_summary = {
"run": "Continue running the system without any changes.", "run": "Continue running the system without any changes.",
"recover": ("You have requested to reboot the system into recovery " "mode."), "recover": "You have requested to reboot the system into recovery mode.",
"install": ( "install": (
"You are about to {action_lower} the system version " "You are about to {action_lower} the system version "
"{version} for {model} from {publisher}.\n\n" "{version} for {model} from {publisher}.\n\n"

View File

@ -24,7 +24,7 @@ from subiquitycore.view import BaseView
log = logging.getLogger("console_conf.ui.views.identity") log = logging.getLogger("console_conf.ui.views.identity")
sso_help = ( sso_help = (
"If you do not have an account, visit " "https://login.ubuntu.com to create one." "If you do not have an account, visit https://login.ubuntu.com to create one."
) )

View File

@ -82,10 +82,7 @@ class SSHController(SubiquityTuiController):
elif response.status == SSHFetchIdStatus.FINGERPRINT_ERROR: elif response.status == SSHFetchIdStatus.FINGERPRINT_ERROR:
if isinstance(self.ui.body, SSHView): if isinstance(self.ui.body, SSHView):
self.ui.body.fetching_ssh_keys_failed( self.ui.body.fetching_ssh_keys_failed(
_( _("ssh-keygen failed to show fingerprint of downloaded keys:"),
"ssh-keygen failed to show fingerprint of"
" downloaded keys:"
),
response.error, response.error,
) )
return return

View File

@ -119,7 +119,7 @@ def make_server_args_parser():
"--snap-section", "--snap-section",
action="store", action="store",
default="server", default="server",
help=("Show snaps from this section of the store in the snap " "list screen."), help="Show snaps from this section of the store in the snap list screen.",
) )
parser.add_argument("--source-catalog", dest="source_catalog", action="store") parser.add_argument("--source-catalog", dest="source_catalog", action="store")
parser.add_argument( parser.add_argument(

View File

@ -109,8 +109,9 @@ def _make_handler(
for param_name, param in def_params.items(): for param_name, param in def_params.items():
if param_name in ("request", "context"): if param_name in ("request", "context"):
raise Exception( raise Exception(
"api method {} cannot have parameter called request or " "api method {} cannot have parameter called request or context".format(
"context".format(definition) definition
)
) )
if getattr(param.annotation, "__origin__", None) is Payload: if getattr(param.annotation, "__origin__", None) is Payload:
data_arg = param_name data_arg = param_name

View File

@ -159,9 +159,7 @@ def _can_edit_generic(device):
cd = device.constructed_device() cd = device.constructed_device()
if cd is None: if cd is None:
return True return True
return _( return _("Cannot edit {selflabel} as it is part of the {cdtype} {cdname}.").format(
"Cannot edit {selflabel} as it is part of the {cdtype} " "{cdname}."
).format(
selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd) selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd)
) )
@ -193,7 +191,7 @@ def _can_edit_vg(vg):
if vg.preserve: if vg.preserve:
return _("Cannot edit pre-existing volume groups.") return _("Cannot edit pre-existing volume groups.")
elif len(vg._partitions) > 0: elif len(vg._partitions) > 0:
return _("Cannot edit {vglabel} because it has logical " "volumes.").format( return _("Cannot edit {vglabel} because it has logical volumes.").format(
vglabel=labels.label(vg) vglabel=labels.label(vg)
) )
else: else:
@ -249,7 +247,7 @@ def _can_remove_device(device):
return False return False
if cd.preserve: if cd.preserve:
return _( return _(
"Cannot remove {selflabel} from pre-existing {cdtype} " "{cdlabel}." "Cannot remove {selflabel} from pre-existing {cdtype} {cdlabel}."
).format( ).format(
selflabel=labels.label(device), selflabel=labels.label(device),
cdtype=labels.desc(cd), cdtype=labels.desc(cd),
@ -290,7 +288,7 @@ def _can_delete_generic(device):
if cd is None: if cd is None:
return True return True
return _( return _(
"Cannot delete {selflabel} as it is part of the {cdtype} " "{cdname}." "Cannot delete {selflabel} as it is part of the {cdtype} {cdname}."
).format( ).format(
selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd) selflabel=labels.label(device), cdtype=labels.desc(cd), cdname=labels.label(cd)
) )
@ -330,7 +328,7 @@ def _can_delete_raid_vg(device):
) )
if mounted_partitions > 1: if mounted_partitions > 1:
return _( return _(
"Cannot delete {devicelabel} because it has {count} mounted " "partitions." "Cannot delete {devicelabel} because it has {count} mounted partitions."
).format(devicelabel=labels.label(device), count=mounted_partitions) ).format(devicelabel=labels.label(device), count=mounted_partitions)
elif mounted_partitions == 1: elif mounted_partitions == 1:
return _( return _(

View File

@ -83,7 +83,7 @@ class FilesystemManipulator:
if gap.in_extended: if gap.in_extended:
if flag not in (None, "logical"): if flag not in (None, "logical"):
log.debug( log.debug(
f"overriding flag {flag} " "due to being in an extended partition" f"overriding flag {flag} due to being in an extended partition"
) )
flag = "logical" flag = "logical"
part = self.model.add_partition( part = self.model.add_partition(

View File

@ -46,7 +46,7 @@ class InconsistentMultiLayoutError(ValueError):
def __init__(self, layouts: str, variants: str) -> None: def __init__(self, layouts: str, variants: str) -> None:
super().__init__( super().__init__(
f'inconsistent multi-layout: layouts="{layouts}"' f' variants="{variants}"' f'inconsistent multi-layout: layouts="{layouts}" variants="{variants}"'
) )
@ -112,7 +112,7 @@ class KeyboardModel:
kbd_variant.code == variant for kbd_variant in kbd_layout.variants kbd_variant.code == variant for kbd_variant in kbd_layout.variants
): ):
raise ValueError( raise ValueError(
f'Unknown keyboard variant "{variant}" ' f'for layout "{layout}"' f'Unknown keyboard variant "{variant}" for layout "{layout}"'
) )
def render_config_file(self): def render_config_file(self):

View File

@ -284,7 +284,7 @@ class MirrorModel(object):
if "primary" in data and "mirror-selection" in data: if "primary" in data and "mirror-selection" in data:
raise ValueError( raise ValueError(
"apt->primary and apt->mirror-selection are" " mutually exclusive." "apt->primary and apt->mirror-selection are mutually exclusive."
) )
self.legacy_primary = "primary" in data self.legacy_primary = "primary" in data

View File

@ -53,7 +53,7 @@ class NetworkModel(CoreNetworkModel):
r = { r = {
"write_files": { "write_files": {
"etc_netplan_installer": { "etc_netplan_installer": {
"path": ("etc/cloud/cloud.cfg.d/90-installer-network.cfg"), "path": "etc/cloud/cloud.cfg.d/90-installer-network.cfg",
"content": self.stringify_config(netplan), "content": self.stringify_config(netplan),
"permissions": "0600", "permissions": "0600",
}, },
@ -104,8 +104,7 @@ class NetworkModel(CoreNetworkModel):
cp = await arun_command(("nmcli", "networking"), check=True) cp = await arun_command(("nmcli", "networking"), check=True)
except subprocess.CalledProcessError as exc: except subprocess.CalledProcessError as exc:
log.warning( log.warning(
"failed to run nmcli networking," "failed to run nmcli networking, considering NetworkManager disabled."
" considering NetworkManager disabled."
) )
log.debug("stderr: %s", exc.stderr) log.debug("stderr: %s", exc.stderr)
return False return False

View File

@ -49,9 +49,7 @@ class ProxyModel(object):
}, },
"write_files": { "write_files": {
"snapd_dropin": { "snapd_dropin": {
"path": ( "path": "etc/systemd/system/snapd.service.d/snap_proxy.conf",
"etc/systemd/system/" "snapd.service.d/snap_proxy.conf"
),
"content": self.proxy_systemd_dropin(), "content": self.proxy_systemd_dropin(),
"permissions": 0o644, "permissions": 0o644,
}, },

View File

@ -243,7 +243,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase):
with self.assertRaises(SchemaValidationError) as ctx: with self.assertRaises(SchemaValidationError) as ctx:
model._cloud_init_config() model._cloud_init_config()
expected_error = ( expected_error = (
"Cloud config schema errors: bootcmd: 'nope' is not of type" " 'array'" "Cloud config schema errors: bootcmd: 'nope' is not of type 'array'"
) )
self.assertEqual(expected_error, str(ctx.exception)) self.assertEqual(expected_error, str(ctx.exception))
@ -314,7 +314,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase):
cfg_files.remove("/etc/cloud/cloud.cfg.d/90-installer-network.cfg") cfg_files.remove("/etc/cloud/cloud.cfg.d/90-installer-network.cfg")
cfg_files.append("/etc/netplan/00-installer-config.yaml") cfg_files.append("/etc/netplan/00-installer-config.yaml")
cfg_files.append( cfg_files.append(
"/etc/cloud/cloud.cfg.d/" "subiquity-disable-cloudinit-networking.cfg" "/etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg"
) )
expected_files[ expected_files[
"etc/cloud/clean.d/99-installer" "etc/cloud/clean.d/99-installer"
@ -379,7 +379,7 @@ class TestSubiquityModel(unittest.IsolatedAsyncioTestCase):
data={"bootcmd": "nope"}, data_source="system info" data={"bootcmd": "nope"}, data_source="system info"
) )
expected_error = ( expected_error = (
"Cloud config schema errors: bootcmd: 'nope' is not of" " type 'array'" "Cloud config schema errors: bootcmd: 'nope' is not of type 'array'"
) )
self.assertEqual(expected_error, str(ctx.exception)) self.assertEqual(expected_error, str(ctx.exception))

View File

@ -401,7 +401,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
raise Exception("autoinstall config did not mount root") raise Exception("autoinstall config did not mount root")
if self.model.needs_bootloader_partition(): if self.model.needs_bootloader_partition():
raise Exception( raise Exception(
"autoinstall config did not create needed bootloader " "partition" "autoinstall config did not create needed bootloader partition"
) )
def update_devices(self, device_map): def update_devices(self, device_map):
@ -1160,7 +1160,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
core_boot_caps.update(variation.capability_info.allowed) core_boot_caps.update(variation.capability_info.allowed)
if not core_boot_caps: if not core_boot_caps:
raise Exception( raise Exception(
"can only use name: hybrid when installing core boot " "classic" "can only use name: hybrid when installing core boot classic"
) )
if "mode" in layout: if "mode" in layout:
raise Exception("cannot use 'mode' when installing core boot classic") raise Exception("cannot use 'mode' when installing core boot classic")
@ -1196,7 +1196,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
break break
else: else:
raise Exception( raise Exception(
"must use name: hybrid when installing core boot " "classic" "must use name: hybrid when installing core boot classic"
) )
mode = layout.get("mode", "reformat_disk") mode = layout.get("mode", "reformat_disk")
self.validate_layout_mode(mode) self.validate_layout_mode(mode)

View File

@ -110,8 +110,9 @@ class IdentityController(SubiquityController):
validated = await self.validate_username_GET(data.username) validated = await self.validate_username_GET(data.username)
if validated != UsernameValidation.OK: if validated != UsernameValidation.OK:
raise ValueError( raise ValueError(
"Username <{}> is invalid and should not be" "Username <{}> is invalid and should not be submitted.".format(
" submitted.".format(data.username), data.username
),
validated, validated,
) )

View File

@ -666,7 +666,7 @@ class InstallController(SubiquityController):
[ [
"chroot", "chroot",
self.tpath(), self.tpath(),
"/usr/share/unattended-upgrades/" "unattended-upgrade-shutdown", "/usr/share/unattended-upgrades/unattended-upgrade-shutdown",
"--stop-only", "--stop-only",
] ]
) )

View File

@ -231,7 +231,7 @@ class MirrorController(SubiquityController):
fallback = self.model.fallback fallback = self.model.fallback
if fallback == MirrorSelectionFallback.ABORT: if fallback == MirrorSelectionFallback.ABORT:
log.error("aborting the install since no primary mirror is" " usable") log.error("aborting the install since no primary mirror is usable")
# TODO there is no guarantee that raising this exception will # TODO there is no guarantee that raising this exception will
# actually abort the install. If this is raised from a request # actually abort the install. If this is raised from a request
# handler, for instance, it will just return a HTTP 500 error. For # handler, for instance, it will just return a HTTP 500 error. For
@ -240,7 +240,7 @@ class MirrorController(SubiquityController):
raise RuntimeError("aborting install since no mirror is usable") raise RuntimeError("aborting install since no mirror is usable")
elif fallback == MirrorSelectionFallback.OFFLINE_INSTALL: elif fallback == MirrorSelectionFallback.OFFLINE_INSTALL:
log.warning( log.warning(
"reverting to an offline install since no primary" " mirror is usable" "reverting to an offline install since no primary mirror is usable"
) )
self.app.base_model.network.force_offline = True self.app.base_model.network.force_offline = True
elif fallback == MirrorSelectionFallback.CONTINUE_ANYWAY: elif fallback == MirrorSelectionFallback.CONTINUE_ANYWAY:

View File

@ -134,7 +134,7 @@ class OEMController(SubiquityController):
variant: str = self.app.base_model.source.current.variant variant: str = self.app.base_model.source.current.variant
fs_controller = self.app.controllers.Filesystem fs_controller = self.app.controllers.Filesystem
if fs_controller.is_core_boot_classic(): if fs_controller.is_core_boot_classic():
log.debug("listing of OEM meta-packages disabled on core boot" " classic") log.debug("listing of OEM meta-packages disabled on core boot classic")
self.model.metapkgs = [] self.model.metapkgs = []
return return
if not self.model.install_on[variant]: if not self.model.install_on[variant]:

View File

@ -137,7 +137,7 @@ class RefreshController(SubiquityController):
and snap.channel != expected_channel and snap.channel != expected_channel
): ):
log.debug( log.debug(
f"snap tracking {snap.channel}, not resetting based " "on .disk/info" f"snap tracking {snap.channel}, not resetting based on .disk/info"
) )
return return
desc = "switching {} to {}".format(self.snap_name, channel) desc = "switching {} to {}".format(self.snap_name, channel)

View File

@ -154,8 +154,10 @@ class MockedUAInterfaceStrategy(UAInterfaceStrategy):
"result": "failure", "result": "failure",
"errors": [ "errors": [
{ {
"title": "The magic attach token is invalid, has " "title": (
" expired or never existed", "The magic attach token is invalid, has "
" expired or never existed"
),
"code": "magic-attach-token-error", "code": "magic-attach-token-error",
}, },
], ],

View File

@ -155,8 +155,7 @@ class DriversView(BaseView):
) )
excerpt = _( excerpt = _(
"The following third-party drivers were found. " "The following third-party drivers were found. Do you want to install them?"
"Do you want to install them?"
) )
def on_cancel(_: DriversForm) -> None: def on_cancel(_: DriversForm) -> None:

View File

@ -194,9 +194,8 @@ class CompoundDiskForm(Form):
potential_boot_disks.add(d) potential_boot_disks.add(d)
if not potential_boot_disks - set(mdc.value): if not potential_boot_disks - set(mdc.value):
return _( return _(
"\ "If you put all disks into RAIDs or LVM VGs, there will be nowhere"
If you put all disks into RAIDs or LVM VGs, there will be nowhere \ " to put the boot partition."
to put the boot partition."
) )

View File

@ -49,9 +49,9 @@ class ConfirmDeleteStretchy(Stretchy):
if m is not None: if m is not None:
lines.append( lines.append(
Text( Text(
_( _("It is formatted as {fstype} and mounted at {path}").format(
"It is formatted as {fstype} and mounted at " "{path}" fstype=fs.fstype, path=m.path
).format(fstype=fs.fstype, path=m.path) )
) )
) )
else: else:
@ -127,7 +127,7 @@ class ConfirmReformatStretchy(Stretchy):
m = fs.mount() m = fs.mount()
if m is not None: if m is not None:
lines.append( lines.append(
_("It is formatted as {fstype} and mounted at " "{path}").format( _("It is formatted as {fstype} and mounted at {path}").format(
fstype=fs.fstype, path=m.path fstype=fs.fstype, path=m.path
) )
) )
@ -147,7 +147,7 @@ class ConfirmReformatStretchy(Stretchy):
things=things, obj=labels.desc(obj) things=things, obj=labels.desc(obj)
) )
lines = [ lines = [
_("Do you really want to remove all {things} from " "{obj}?").format( _("Do you really want to remove all {things} from {obj}?").format(
things=things, obj=labels.label(obj) things=things, obj=labels.label(obj)
), ),
"", "",

View File

@ -88,7 +88,7 @@ class VolGroupForm(CompoundDiskForm):
def validate_devices(self): def validate_devices(self):
if len(self.devices.value) < 1: if len(self.devices.value) < 1:
return _("Select at least one device to be part of the volume " "group.") return _("Select at least one device to be part of the volume group.")
def validate_name(self): def validate_name(self):
v = self.name.value v = self.name.value
@ -102,9 +102,7 @@ class VolGroupForm(CompoundDiskForm):
) )
if v in (".", "..", "md") or os.path.exists("/dev/" + v): if v in (".", "..", "md") or os.path.exists("/dev/" + v):
if v not in self.deleted_vg_names: if v not in self.deleted_vg_names:
return _("{name} is not a valid name for a volume " "group").format( return _("{name} is not a valid name for a volume group").format(name=v)
name=v
)
def validate_passphrase(self): def validate_passphrase(self):
if self.encrypt.value and len(self.passphrase.value) < 1: if self.encrypt.value and len(self.passphrase.value) < 1:

View File

@ -258,7 +258,7 @@ class PartitionForm(Form):
]: ]:
if substring in v: if substring in v:
return _( return _(
"The name of a logical volume may not contain " '"{substring}"' 'The name of a logical volume may not contain "{substring}"'
).format(substring=substring) ).format(substring=substring)
if v in self.lvm_names: if v in self.lvm_names:
return _("There is already a logical volume named {name}.").format( return _("There is already a logical volume named {name}.").format(

View File

@ -55,7 +55,7 @@ class RaidnameEditor(StringEditor, WantsToKnowFormField):
if len(ch) == 1 and ch == "/": if len(ch) == 1 and ch == "/":
self.bff.in_error = True self.bff.in_error = True
self.bff.show_extra( self.bff.show_extra(
("info_error", _("/ is not permitted " "in the name of a RAID device")) ("info_error", _("/ is not permitted in the name of a RAID device"))
) )
return False return False
elif len(ch) == 1 and ch.isspace(): elif len(ch) == 1 and ch.isspace():
@ -63,7 +63,7 @@ class RaidnameEditor(StringEditor, WantsToKnowFormField):
self.bff.show_extra( self.bff.show_extra(
( (
"info_error", "info_error",
_("Whitespace is not permitted in the " "name of a RAID device"), _("Whitespace is not permitted in the name of a RAID device"),
) )
) )
return False return False
@ -104,7 +104,7 @@ class RaidForm(CompoundDiskForm):
active_device_count = len(self.devices.widget.active_devices) active_device_count = len(self.devices.widget.active_devices)
if active_device_count < self.level.value.min_devices: if active_device_count < self.level.value.min_devices:
return _( return _(
'RAID Level "{level}" requires at least {min_active} active' " devices" 'RAID Level "{level}" requires at least {min_active} active devices'
).format( ).format(
level=self.level.value.name, min_active=self.level.value.min_devices level=self.level.value.name, min_active=self.level.value.min_devices
) )

View File

@ -45,7 +45,7 @@ class RealnameEditor(StringEditor, WantsToKnowFormField):
self.bff.show_extra( self.bff.show_extra(
( (
"info_error", "info_error",
_("The characters : , and = are not permitted" " in this field"), _("The characters : , and = are not permitted in this field"),
) )
) )
return False return False
@ -91,7 +91,7 @@ class UsernameEditor(StringEditor, _AsyncValidatedMixin, WantsToKnowFormField):
def __init__(self): def __init__(self):
self.valid_char_pat = r"[-a-z0-9_]" self.valid_char_pat = r"[-a-z0-9_]"
self.error_invalid_char = _( self.error_invalid_char = _(
"The only characters permitted in this " "field are a-z, 0-9, _ and -" "The only characters permitted in this field are a-z, 0-9, _ and -"
) )
super().__init__() super().__init__()

View File

@ -35,7 +35,7 @@ from subiquitycore.view import BaseView
log = logging.getLogger("subiquity.ui.views.mirror") log = logging.getLogger("subiquity.ui.views.mirror")
mirror_help = _( mirror_help = _(
"You may provide an archive mirror that will be used instead " "of the default." "You may provide an archive mirror that will be used instead of the default."
) )
MIRROR_CHECK_CONFIRMATION_TEXTS = { MIRROR_CHECK_CONFIRMATION_TEXTS = {
@ -80,11 +80,10 @@ class MirrorForm(Form):
# * the status of the mirror check (or None if it hasn't started yet) # * the status of the mirror check (or None if it hasn't started yet)
MIRROR_CHECK_STATUS_TEXTS = { MIRROR_CHECK_STATUS_TEXTS = {
(False, None): _( (False, None): _(
"The mirror location cannot be checked because no network" "The mirror location cannot be checked because no network has been configured."
" has been configured."
), ),
(True, None): _("The mirror location has not yet started."), (True, None): _("The mirror location has not yet started."),
(True, MirrorCheckStatus.RUNNING): _("The mirror location is being" " tested."), (True, MirrorCheckStatus.RUNNING): _("The mirror location is being tested."),
(True, MirrorCheckStatus.OK): _("This mirror location passed tests."), (True, MirrorCheckStatus.OK): _("This mirror location passed tests."),
(True, MirrorCheckStatus.FAILED): _( (True, MirrorCheckStatus.FAILED): _(
"""\ """\
@ -98,9 +97,7 @@ explain the problem. You can try again once the issue has been fixed
class MirrorView(BaseView): class MirrorView(BaseView):
title = _("Configure Ubuntu archive mirror") title = _("Configure Ubuntu archive mirror")
excerpt = _( excerpt = _("If you use an alternative mirror for Ubuntu, enter its details here.")
"If you use an alternative mirror for Ubuntu, enter its " "details here."
)
def __init__( def __init__(
self, self,

View File

@ -47,7 +47,7 @@ _ssh_import_data = {
"help": _("Enter your GitHub username."), "help": _("Enter your GitHub username."),
"valid_char": r"[a-zA-Z0-9\-]", "valid_char": r"[a-zA-Z0-9\-]",
"error_invalid_char": _( "error_invalid_char": _(
"A GitHub username may only contain " "alphanumeric characters or hyphens." "A GitHub username may only contain alphanumeric characters or hyphens."
), ),
}, },
"lp": { "lp": {

View File

@ -193,7 +193,7 @@ class UpgradeYesNoForm(Form):
group, group,
_("Skip for now"), _("Skip for now"),
help="\n" help="\n"
+ _("You can always enable Ubuntu Pro later via the" " 'pro attach' command."), + _("You can always enable Ubuntu Pro later via the 'pro attach' command."),
) )
@ -388,9 +388,7 @@ class UbuntuProView(BaseView):
" STIG, HIPAA and other compliance or hardening" " STIG, HIPAA and other compliance or hardening"
" requirements." " requirements."
) )
excerpt_no_net = _( excerpt_no_net = _("An Internet connection is required to enable Ubuntu Pro.")
"An Internet connection is required to enable" " Ubuntu Pro."
)
about_pro_btn = menu_btn( about_pro_btn = menu_btn(
_("About Ubuntu Pro"), on_press=lambda unused: self.show_about_ubuntu_pro() _("About Ubuntu Pro"), on_press=lambda unused: self.show_about_ubuntu_pro()
@ -688,7 +686,7 @@ class ExpiredTokenWidget(Stretchy):
self.parent = parent self.parent = parent
cont = done_btn(label=_("Okay"), on_press=lambda unused: self.close()) cont = done_btn(label=_("Okay"), on_press=lambda unused: self.close())
widgets = [ widgets = [
Text(_("Your token has expired. Please use another token" " to continue.")), Text(_("Your token has expired. Please use another token to continue.")),
Text(""), Text(""),
button_pile([cont]), button_pile([cont]),
] ]
@ -814,7 +812,7 @@ class AboutProWidget(Stretchy):
_("10 years of security patch coverage (extended from 5 years)."), _("10 years of security patch coverage (extended from 5 years)."),
_("Kernel Livepatch to reduce required reboots."), _("Kernel Livepatch to reduce required reboots."),
_("Ubuntu Security Guide for CIS and DISA-STIG hardening."), _("Ubuntu Security Guide for CIS and DISA-STIG hardening."),
_("FIPS 140-2 NIST-certified crypto-modules for FedRAMP" " compliance"), _("FIPS 140-2 NIST-certified crypto-modules for FedRAMP compliance"),
] ]
def itemize(item: str, marker: str = "") -> Columns: def itemize(item: str, marker: str = "") -> Columns:
@ -834,7 +832,7 @@ class AboutProWidget(Stretchy):
Text(""), Text(""),
Pile([itemize(svc, marker="") for svc in services]), Pile([itemize(svc, marker="") for svc in services]),
Text(""), Text(""),
Text(_("Ubuntu Pro is free for personal use on up to 3" " machines.")), Text(_("Ubuntu Pro is free for personal use on up to 3 machines.")),
Text(_("More information is at ubuntu.com/pro")), Text(_("More information is at ubuntu.com/pro")),
Text(""), Text(""),
button_pile([ok]), button_pile([ok]),

View File

@ -374,8 +374,7 @@ class BaseNetworkController(BaseController):
await arun_command(["netplan", "apply"], env=env, check=True) await arun_command(["netplan", "apply"], env=env, check=True)
except subprocess.CalledProcessError as cpe: except subprocess.CalledProcessError as cpe:
log.debug( log.debug(
"CalledProcessError: " f"CalledProcessError: stdout[{cpe.stdout}] stderr[{cpe.stderr}]"
f"stdout[{cpe.stdout}] stderr[{cpe.stderr}]"
) )
error("apply") error("apply")
raise raise

View File

@ -500,7 +500,7 @@ class NetworkView(BaseView):
) )
elif action == "timeout": elif action == "timeout":
self.error.set_text( self.error.set_text(
"Network configuration timed out; " "please verify your settings." "Network configuration timed out; please verify your settings."
) )
elif action == "down": elif action == "down":
self.error.set_text("Downing network interfaces failed.") self.error.set_text("Downing network interfaces failed.")
@ -510,7 +510,7 @@ class NetworkView(BaseView):
self.error.set_text("Failed to delete a virtual interface.") self.error.set_text("Failed to delete a virtual interface.")
else: else:
self.error.set_text( self.error.set_text(
"An unexpected error has occurred; " "please verify your settings." "An unexpected error has occurred; please verify your settings."
) )
def done(self, result=None): def done(self, result=None):

View File

@ -222,7 +222,7 @@ def crypt_password(passwd, algo="SHA-512"):
) )
) )
salt_set = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789./" salt_set = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"
salt = 16 * " " salt = 16 * " "
salt = "".join([random.choice(salt_set) for c in salt]) salt = "".join([random.choice(salt_set) for c in salt])
return crypt.crypt(passwd, algos[algo] + salt) return crypt.crypt(passwd, algos[algo] + salt)

View File

@ -38,8 +38,10 @@ def make_server_args_parser():
parser.add_argument( parser.add_argument(
"--prefill", "--prefill",
dest="prefill", dest="prefill",
help="Prefills UI models with data provided in" help=(
" a prefill.yaml file yet allowing overrides.", "Prefills UI models with data provided in"
" a prefill.yaml file yet allowing overrides."
),
) )
parser.add_argument( parser.add_argument(
"--output-base", "--output-base",
@ -54,9 +56,11 @@ def make_server_args_parser():
type=int, type=int,
choices=range(49152, 60999), choices=range(49152, 60999),
metavar="[49152 to 60999]", metavar="[49152 to 60999]",
help="The TCP port Subiquity must listen to. It means " help=(
"The TCP port Subiquity must listen to. It means "
"TCP will be used instead of Unix domain sockets. " "TCP will be used instead of Unix domain sockets. "
"Only localhost connections are accepted.", "Only localhost connections are accepted."
),
) )
return parser return parser

View File

@ -55,8 +55,10 @@ def make_client_args_parser():
parser.add_argument( parser.add_argument(
"--prefill", "--prefill",
dest="prefill", dest="prefill",
help="Prefills UI models with data provided in" help=(
" a prefill.yaml file yet allowing overrides.", "Prefills UI models with data provided in"
" a prefill.yaml file yet allowing overrides."
),
) )
parser.add_argument( parser.add_argument(
"--output-base", "--output-base",

View File

@ -166,7 +166,7 @@ class ConfigureController(SubiquityController):
envcp = None envcp = None
if not os.path.exists(data_dir): if not os.path.exists(data_dir):
log.error( log.error(
"Language selector data dir %s seems not to be part" " of the snap.", "Language selector data dir %s seems not to be part of the snap.",
data_dir, data_dir,
) )
# Try seeded L-S-C # Try seeded L-S-C
@ -405,7 +405,7 @@ class ConfigureController(SubiquityController):
assign_grp_proc = await arun_command(assign_grp_cmd, env=env) assign_grp_proc = await arun_command(assign_grp_cmd, env=env)
if assign_grp_proc.returncode != 0: if assign_grp_proc.returncode != 0:
raise Exception( raise Exception(
("Failed to assign group to user %s: %s") "Failed to assign group to user %s: %s"
% (username, assign_grp_proc.stderr) % (username, assign_grp_proc.stderr)
) )

View File

@ -70,7 +70,7 @@ class WSLConfigurationAdvancedForm(Form):
class WSLConfigurationAdvancedView(BaseView): class WSLConfigurationAdvancedView(BaseView):
title = _("WSL Configuration - Advanced options") title = _("WSL Configuration - Advanced options")
excerpt = _( excerpt = _(
"In this page, you can configure Ubuntu WSL " "advanced options your needs. \n" "In this page, you can configure Ubuntu WSL advanced options your needs. \n"
) )
def __init__(self, controller, configuration_data): def __init__(self, controller, configuration_data):

View File

@ -38,21 +38,21 @@ class WSLConfBaseForm(Form):
_("Mount Location"), help=_("Location for the automount") _("Mount Location"), help=_("Location for the automount")
) )
automount_options = StringField( automount_options = StringField(
_("Mount Option"), help=_("Mount option passed " "for the automount") _("Mount Option"), help=_("Mount option passed for the automount")
) )
network_generatehosts = BooleanField( network_generatehosts = BooleanField(
_("Enable Host Generation"), _("Enable Host Generation"),
help=_("Selecting enables /etc/host re-generation at" " every start"), help=_("Selecting enables /etc/host re-generation at every start"),
) )
network_generateresolvconf = BooleanField( network_generateresolvconf = BooleanField(
_("Enable resolv.conf Generation"), _("Enable resolv.conf Generation"),
help=_("Selecting enables /etc/resolv.conf re-generation" " at every start"), help=_("Selecting enables /etc/resolv.conf re-generation at every start"),
) )
def validate_automount_root(self): def validate_automount_root(self):
p = self.automount_root.value p = self.automount_root.value
if p != "" and (re.fullmatch(r"(/[^/ ]*)+/?", p) is None): if p != "" and (re.fullmatch(r"(/[^/ ]*)+/?", p) is None):
return _("Mount location must be a absolute UNIX path" " without space.") return _("Mount location must be a absolute UNIX path without space.")
def validate_automount_options(self): def validate_automount_options(self):
o = self.automount_options.value o = self.automount_options.value