On Thu, 2012-11-15 at 22:32 -0800, Jesse Keating wrote:
Re-arranges a bit of code and handles dracut mounted hd isos.
See comments below. Apart from them this looks good to me.
pyanaconda/packaging/yumpayload.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index b52fb67..1a8b91c 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -498,7 +498,14 @@ reposdir=%s @property def ISOImage(self): if self.data.method.method == "harddrive":
return get_mount_device(INSTALL_TREE)[len(ISO_DIR)+1:]
# This could either be mounted to INSTALL_TREE or on
# DRACUT_REPODIR if dracut did the mount.
dev = get_mount_device(INSTALL_TREE)
if dev:
return dev[len(ISO_DIR)+1:]
dev = get_mount_device(DRACUT_REPODIR)
if dev:
return dev[len(DRACUT_ISODIR)+1:]
What if both fail? Is it okay to return None from this method?
def _setUpMedia(self, device): method = self.data.method
@@ -560,6 +567,9 @@ reposdir=%s method = self.data.method sslverify = True url = None
# See if we already have stuff mounted due to dracut
isodev = get_mount_device(DRACUT_ISODIR)
device = get_mount_device(DRACUT_REPODIR) if method.method == "harddrive": if method.biospart:
@@ -567,15 +577,22 @@ reposdir=%s devspec = method.biospart else: devspec = method.partition
device = storage.devicetree.resolveDevice(devspec)
self._setUpMedia(device)
self.install_device = device
url = "file://" + INSTALL_TREE
needmount = True
# See if we used this method for stage2, thus dracut left it
if isodev and method.partition and method.partition in isodev:
# See if the iso is mounted
if DRACUT_ISODIR in device:
You could squash these two ifs to the one.
# Everything shoud be setup
"should be setup"
url = "file://" + DRACUT_REPODIR
needmount = False
# We don't setup an install_device here
# because we can't tear it down
isodevice = storage.devicetree.resolveDevice(devspec)
if needmount:
self._setUpMedia(isodevice)
url = "file://" + INSTALL_TREE
self.install_device = isodevice elif method.method == "nfs":
# See if we already have stuff mounted due to dracut
isodev = get_mount_device(DRACUT_ISODIR)
device = get_mount_device(DRACUT_REPODIR) # See if dracut dealt with nfsiso if isodev: options, host, path = iutil.parseNfsUrl('nfs:%s' % isodev)