kiwi-el8/kiwi/internal_boot_image_task.py
Marcus Schäfer a7fb5649f5 Refactor internal boot image task
Make a factory out of the task and allow to have e.g
a dracut boot image task at a later point in time.
The BootImageBase class creates an interface for this
implementation. So far only BootImageKiwi is implemented
2016-02-11 11:19:57 +01:00

39 lines
1.2 KiB
Python

# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# kiwi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kiwi. If not, see <http://www.gnu.org/licenses/>
#
# project
from boot_image_kiwi import BootImageKiwi
from exceptions import(
KiwiBootImageSetupError
)
class BootImageTask(object):
"""
BootImageTask factory
"""
def __new__(
self, initrd_type, xml_state, target_dir, root_dir=None
):
if initrd_type == 'kiwi':
return BootImageKiwi(xml_state, target_dir, root_dir)
else:
raise KiwiBootImageSetupError(
'Support for %s boot image task not implemented' % initrd_type
)