Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad assumption about base repo identification #1937

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions pyanaconda/image.py
Expand Up @@ -98,7 +98,7 @@ def findFirstIsoImage(path):
# If there's no repodata, there's no point in trying to
# install from it.
if not _check_repodata(mount_path):
log.warning("%s doesn't have repodata, skipping", what)
log.warning("%s doesn't have a valid repodata, skipping", what)
blivet.util.umount(mount_path)
continue

Expand Down Expand Up @@ -140,9 +140,26 @@ def _check_repodata(mount_path):
repo_md = install_tree_meta.get_base_repo_metadata()

if not repo_md:
repo_mds = install_tree_meta.get_metadata_repos()
repo_md = _search_for_install_root_repository(repo_mds)

if not repo_md:
log.debug("There is no usable repository available")
return False

return repo_md.is_valid()
if repo_md.is_valid():
return True

log.debug("There is no valid repository available.")
return False


def _search_for_install_root_repository(repos):
for repo in repos:
if repo.relative_path == ".":
return repo

return None


def mountImage(isodir, tree):
Expand Down
13 changes: 9 additions & 4 deletions pyanaconda/payload/__init__.py
Expand Up @@ -466,9 +466,11 @@ def _setup_device(device, mountpoint):

@staticmethod
def _setup_NFS(mountpoint, server, path, options):
"""Prepare an NFS directory for use as a package source."""
"""Prepare an NFS directory for use as an install source."""
log.info("mounting %s:%s:%s on %s", server, path, options, mountpoint)
dev = payload_utils.get_mount_device(mountpoint)

# test if the mountpoint is occupied already
if dev:
_server, colon, _path = dev.partition(":")
if colon == ":" and server == _server and path == _path:
Expand Down Expand Up @@ -980,8 +982,8 @@ def _setup_nfs_device(self, storage, method, isodev, device):
nfs_dir = os.path.dirname(method.dir)
else:
nfs_dir = method.dir
self._setup_NFS(INSTALL_TREE, method.server, nfs_dir,
method.opts)

self._setup_NFS(INSTALL_TREE, method.server, nfs_dir, method.opts)
path = INSTALL_TREE

# check for ISO images in the newly mounted dir
Expand Down Expand Up @@ -1012,9 +1014,12 @@ def _setup_nfs_device(self, storage, method, isodev, device):
mountImage(image, INSTALL_TREE)

url = "file://" + INSTALL_TREE
else:
elif os.path.isdir(path):
# Fall back to the mount path instead of a mounted iso
url = "file://" + path
else:
# Do not try to use iso as source if it is not valid source
raise PayloadSetupError("Not a valid ISO image!")

return url

Expand Down