mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-28 01:58:08 +03:00
virt-manager: Don't allow an empty string for a network name
When starting the 'Create virtual network' wizard, you are allowed to proceed without specifying a Network Name. An error only occurs after all else is completed with the wizard. This patch stops the user from proceeding if a network name has not been specified. The check for an empty string is done in util.py which also effects storage pool names and guest names neither of which should have empty strings. Signed-off-by: Charles Arnold <carnold@suse.com> Message-Id: <551D664702000091000F42E8@prv-mh.provo.novell.com>
This commit is contained in:
parent
ce74cd7726
commit
20fe287341
@ -1743,7 +1743,10 @@ class vmmCreate(vmmGObjectUI):
|
||||
# HV + Arch selection
|
||||
name = self.get_config_name()
|
||||
if name != self.guest.name:
|
||||
self.guest.name = name
|
||||
try:
|
||||
self.guest.name = name
|
||||
except Exception, e:
|
||||
return self.err.val_err(_("Invalid guest name"), str(e))
|
||||
if self.is_default_storage():
|
||||
logging.debug("User changed VM name and using default storage,"
|
||||
"re-validating with new default storage path.")
|
||||
|
@ -479,8 +479,6 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
|
||||
def _validate_page_name(self, usepool=None):
|
||||
name = self.get_config_name()
|
||||
if not name:
|
||||
return self.err.val_err(_("A name must be specified."))
|
||||
|
||||
try:
|
||||
if usepool:
|
||||
|
@ -143,6 +143,9 @@ def validate_name(name_type, val):
|
||||
# Rather than try and match libvirt's regex, just forbid things we
|
||||
# know don't work
|
||||
forbid = [" "]
|
||||
if not val:
|
||||
raise ValueError(
|
||||
_("A name must be specified for the %s") % name_type)
|
||||
for c in forbid:
|
||||
if c not in val:
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user