[Xend/ACM] Provide explicit initialization function for bootloader class

This patch refactors the initialization code for the bootloader class
and puts it into an explicit initialization function that is called
from another class.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
This commit is contained in:
Keir Fraser committed 2008-05-01 09:55:45 +01:00
1 parent f0dc96dc71
commit a2f23ae851
2 files changed
+15 -11

No files matched your search

+14 -11
View File
@@ -26,8 +26,6 @@ from xen.xend.XendLogging import log
from xen.util import mkdir
import xen.util.xsm.xsm as security
__bootloader = None
#
# Functions for modifying entries in the bootloader, i.e. adding
# a module to boot the system with a policy.
@@ -513,8 +511,11 @@ class LatePolicyLoader(Bootloader):
Bootloader.__init__(self)
def probe(self):
_dir=os.path.dirname(self.FILENAME)
mkdir.parents(_dir, stat.S_IRWXU)
try:
_dir=os.path.dirname(self.FILENAME)
mkdir.parents(_dir, stat.S_IRWXU)
except:
return False
return True
def get_default_title(self):
@@ -614,10 +615,12 @@ class LatePolicyLoader(Bootloader):
__bootloader = Bootloader()
grub = Grub()
if grub.probe() == True:
__bootloader = grub
else:
late = LatePolicyLoader()
if late.probe() == True:
__bootloader = late
def init():
global __bootloader
grub = Grub()
if grub.probe() == True:
__bootloader = grub
else:
late = LatePolicyLoader()
if late.probe() == True:
__bootloader = late
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.