Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit c61ecaf

Browse files
committed
Check file is not block if type = file. Check os_type specified before validating os_variant. Error message fix in if no valid distro found at install source.
1 parent 79741d3 commit c61ecaf

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

virtinst/DistroManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _storeForDistro(fetcher, baseuri, type, progresscb, distro=None, scratchdir=
7777
if store.isValidStore(fetcher, progresscb):
7878
return store
7979

80-
raise ValueError, _("Could not find an installable distribution the install location")
80+
raise ValueError, _("Could not find an installable distribution at '%s'" % baseuri)
8181

8282

8383
# Method to fetch a krenel & initrd pair for a particular distro / HV type

virtinst/FullVirtGuest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def set_os_type(self, val):
148148
def get_os_variant(self):
149149
return self._os_variant
150150
def set_os_variant(self, val):
151+
if not self._os_type:
152+
raise ValueError, _("An OS type must be specified before a variant.")
151153
if FullVirtGuest.OS_TYPES[self._os_type]["variants"].has_key(val):
152154
self._os_variant = val
153155
else:

virtinst/Guest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def __init__(self, path = None, size = None, transient=False, type=None, device=
9595
if self.size is None and not os.path.exists(self.path):
9696
raise ValueError, \
9797
_("A size must be provided for non-existent disks")
98+
if os.path.exists(self.path) and \
99+
stat.S_ISBLK(os.stat(self.path)[stat.ST_MODE]):
100+
raise ValueError, _("The specified path is a block device, not a regular file.")
98101
if self.size is not None and \
99102
(__builtin__.type(self.size) is not __builtin__.type(1) and __builtin__.type(self.size) is not __builtin__.type(1.0)):
100103
raise ValueError, _("Disk size must be an int or a float.")

0 commit comments

Comments
 (0)