def __init__( self, xml_state, root_dir, allow_existing=False ): """ Setup and host bind new root system at given root_dir directory """ log.info('Setup root directory: %s', root_dir) if not log.getLogLevel() == logging.DEBUG and not log.get_logfile(): self.issue_message = dedent(''' {headline}: {reason} Further details to clarify the error might have been reported earlier in the package manager log information and did not get exposed to the caller. Thus if the above message is not clear on the error please call kiwi with the --debug or --logfile option. ''') else: self.issue_message = '{headline}: {reason}' root = RootInit( root_dir, allow_existing ) root.create() image_uri = xml_state.get_derived_from_image_uri() if image_uri: root_import = RootImport.new( root_dir, image_uri, xml_state.build_type.get_image() ) root_import.sync_data() root_bind = RootBind( root ) root_bind.setup_intermediate_config() root_bind.mount_kernel_file_systems() root_bind.mount_shared_directory() self.xml_state = xml_state self.profiles = xml_state.profiles self.root_bind = root_bind # A list of Uri references is stored inside of the System instance # in order to delay the Uri destructors until the System instance # dies. This is needed to keep bind mounted Uri locations alive # for System operations self.uri_list = []
def test_not_implemented_import(self): with raises(KiwiRootImportError): RootImport.new('root_dir', 'file:///image.tar.xz', 'foo')
def test_oci_import(self, mock_oci_import): RootImport.new('root_dir', 'file:///image.tar.xz', 'oci') mock_oci_import.assert_called_once_with( 'root_dir', 'file:///image.tar.xz', {'archive_transport': 'oci-archive'} )