#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
"""
Various bootloader interfaces for pybootmgmt
"""
import sys
"""Factory that returns BootLoader instances.
"""
"""Returns an instance of bootloader.BootLoader appropriate for the
system identified by the keyword arguments passed in. Invokes a
probe function for each boot loader backend, and returns the loader
whose probe function returned the highest rank value. If multiple
boot loaders' probe functions succeed, a ProxyBootLoader instance is
returned that will manage access to both BootLoader instances.
"""
loaderlist = []
loader_instance = None
for loader in BOOT_LOADER_BACKENDS:
try:
if not loaderinst is None:
except BootmgmtError as bmerr:
if loaderclass:
raise BootmgmtInvalidBootloaderError('Could not find an '
return loaders[0]
# Sort the loader list by decreasing rank:
'detected')
else:
return loader_instance