summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2020-08-23 14:15:17 -0400
committerCole Robinson <crobinso@redhat.com>2020-08-26 15:20:05 -0400
commit2f4aa652d3386857bfd74cd127c3a6eefb142526 (patch)
treea18891868bcac31a21241689b69fb951d7d5b621
parentbe2b308ae45e821382fabc9674a7f955eb53220d (diff)
downloadvirt-manager-2f4aa652d3386857bfd74cd127c3a6eefb142526.tar.gz
error: Try not to split val_err over multiple lines
Helps grepping for val_err usage, and grepping for error strings Signed-off-by: Cole Robinson <crobinso@redhat.com>
-rw-r--r--virtManager/createconn.py4
-rw-r--r--virtManager/createvm.py41
-rw-r--r--virtManager/details/details.py8
3 files changed, 27 insertions, 26 deletions
diff --git a/virtManager/createconn.py b/virtManager/createconn.py
index bf8c0d5a..d4aae9f3 100644
--- a/virtManager/createconn.py
+++ b/virtManager/createconn.py
@@ -234,8 +234,8 @@ class vmmCreateConn(vmmGObjectUI):
host = self.widget("hostname").get_text()
if is_remote and not host:
- return self.err.val_err(_("A hostname is required for "
- "remote connections."))
+ msg = _("A hostname is required for remote connections.")
+ return self.err.val_err(msg)
return True
diff --git a/virtManager/createvm.py b/virtManager/createvm.py
index 813a5037..c07a4920 100644
--- a/virtManager/createvm.py
+++ b/virtManager/createvm.py
@@ -1489,19 +1489,19 @@ class vmmCreateVM(vmmGObjectUI):
# Require username and password when authenticate
# to source registry.
if user and not passwd:
- return self.err.val_err(_("Please specify password "
- "for accessing source registry"))
+ msg = _("Please specify password for accessing source registry")
+ return self.err.val_err(msg)
# Validate destination path
if not os.path.exists(fs):
return
if not os.path.isdir(fs):
- return self.err.val_err(_("Destination path "
- "is not directory: %s") % fs)
+ msg = _("Destination path is not directory: %s") % fs
+ return self.err.val_err(msg)
if not os.access(fs, os.W_OK):
- return self.err.val_err(_("No write permissions for "
- "directory path: %s") % fs)
+ msg = _("No write permissions for directory path: %s") % fs
+ return self.err.val_err(msg)
if os.listdir(fs) == []:
return
@@ -1525,14 +1525,15 @@ class vmmCreateVM(vmmGObjectUI):
osobj = self._os_list.get_selected_os()
if not self._is_container_install() and not osobj:
- return self.err.val_err(_("You must select an OS.") +
- "\n\n" + self._os_list.eol_text)
+ msg = _("You must select an OS.")
+ msg += "\n\n" + self._os_list.eol_text
+ return self.err.val_err(msg)
if instmethod == INSTALL_PAGE_ISO:
media = self._get_config_local_media()
if not media:
- return self.err.val_err(
- _("An install media selection is required."))
+ msg = _("An install media selection is required.")
+ return self.err.val_err(msg)
cdrom = media
elif instmethod == INSTALL_PAGE_URL:
@@ -1547,14 +1548,14 @@ class vmmCreateVM(vmmGObjectUI):
is_import = True
import_path = self._get_config_import_path()
if not import_path:
- return self.err.val_err(
- _("A storage path to import is required."))
+ msg = _("A storage path to import is required.")
+ return self.err.val_err(msg)
if not virtinst.DeviceDisk.path_definitely_exists(
self.conn.get_backend(),
import_path):
- return self.err.val_err(_("The import path must point to "
- "an existing storage."))
+ msg = _("The import path must point to an existing storage.")
+ return self.err.val_err(msg)
elif instmethod == INSTALL_PAGE_CONTAINER_APP:
init = self.widget("install-app-entry").get_text()
@@ -1599,8 +1600,8 @@ class vmmCreateVM(vmmGObjectUI):
self._gdata.filesystem = fsdev
except Exception as e:
- return self.err.val_err(
- _("Error setting install media location."), e)
+ msg = _("Error setting install media location.")
+ return self.err.val_err(msg, e)
# Build the installer and Guest instance
try:
@@ -1612,8 +1613,8 @@ class vmmCreateVM(vmmGObjectUI):
guest = self._gdata.build_guest()
installer = self._gdata.build_installer()
except Exception as e:
- return self.err.val_err(
- _("Error setting installer parameters."), e)
+ msg = _("Error setting installer parameters.")
+ return self.err.val_err(msg, e)
try:
name = virtinst.Guest.generate_name(guest)
@@ -1747,8 +1748,8 @@ class vmmCreateVM(vmmGObjectUI):
# No network device available
instmethod = self._get_config_install_page()
if instmethod == INSTALL_PAGE_URL:
- return self.err.val_err(
- _("Network device required for URL install."))
+ msg = _("Network device required for URL install.")
+ return self.err.val_err(msg)
macaddr = virtinst.DeviceInterface.generate_mac(
self.conn.get_backend())
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index cc63a450..f928a0d4 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -1592,11 +1592,11 @@ class vmmDetails(vmmGObjectUI):
checksens=True)
if kwargs["initrd"] and not kwargs["kernel"]:
- return self.err.val_err(
- _("Cannot set initrd without specifying a kernel path"))
+ msg = _("Cannot set initrd without specifying a kernel path")
+ return self.err.val_err(msg)
if kwargs["kernel_args"] and not kwargs["kernel"]:
- return self.err.val_err(
- _("Cannot set kernel arguments without specifying a kernel path"))
+ msg = _("Cannot set kernel arguments without specifying a kernel path")
+ return self.err.val_err(msg)
if self.edited(EDIT_INIT):
kwargs["init"] = self.get_text("boot-init-path")