Example #1
0
 def new(
     xml_state: object, target_dir: str,
     root_dir: str=None, signing_keys: List=None  # noqa: E252
 ):
     initrd_system = xml_state.get_initrd_system()
     name_map = {
         'builtin_kiwi':
             'BootImageKiwi' if initrd_system == 'kiwi' else None,
         'dracut':
             'BootImageDracut' if initrd_system == 'dracut' else None
     }
     for boot_image_namespace, boot_image_name in list(name_map.items()):
         if boot_image_name:
             break
     try:
         boot_image = importlib.import_module(
             'kiwi.boot.image.{0}'.format(boot_image_namespace)
         )
         return boot_image.__dict__[boot_image_name](
             xml_state, target_dir, root_dir, signing_keys
         )
     except Exception as issue:
         raise KiwiBootImageSetupError(
             'Support for {0} initrd system not implemented: {1}'.format(
                 initrd_system, issue
             )
         )
Example #2
0
 def new(
         xml_state: XMLState,
         target_dir: str,
         root_dir: str = None,
         signing_keys: List = None  # noqa: E252
 ):
     initrd_system = xml_state.get_initrd_system()
     name_map = {
         'kiwi': {
             'builtin_kiwi': 'BootImageKiwi'
         },
         'dracut': {
             'dracut': 'BootImageDracut'
         }
     }
     try:
         (boot_image_namespace, boot_image_name) = \
             list(name_map[initrd_system].items())[0]
         boot_image = importlib.import_module(
             'kiwi.boot.image.{0}'.format(boot_image_namespace))
         return boot_image.__dict__[boot_image_name](xml_state, target_dir,
                                                     root_dir, signing_keys)
     except Exception as issue:
         raise KiwiBootImageSetupError(
             'Support for {0} initrd system not implemented: {1}'.format(
                 initrd_system, issue))
Example #3
0
 def __new__(self, xml_state, target_dir, root_dir=None, signing_keys=None):
     initrd_system = xml_state.get_initrd_system()
     if initrd_system == 'kiwi':
         return BootImageKiwi(xml_state, target_dir, None, signing_keys)
     elif initrd_system == 'dracut':
         return BootImageDracut(xml_state, target_dir, root_dir, None)
     else:
         raise KiwiBootImageSetupError(
             'Support for %s initrd system not implemented' % initrd_system)