def _test_get_config_drive_manager(self, mock_load_class, platform):
     sys.platform = platform
     if platform is not "win32":
         self.assertRaises(NotImplementedError,
                           factory.get_config_drive_manager)
     else:
         response = factory.get_config_drive_manager()
         mock_load_class.assert_called_once_with(
             'cloudbaseinit.metadata.services.osconfigdrive.'
             'windows.WindowsConfigDriveManager')
         self.assertIsNotNone(response)
Exemple #2
0
    def load(self):
        super(ConfigDriveService, self).load()

        self._preprocess_options()
        self._mgr = factory.get_config_drive_manager()
        found = self._mgr.get_config_drive_files(
            searched_types=self._searched_types,
            searched_locations=self._searched_locations)

        if found:
            self._metadata_path = self._mgr.target_path
            LOG.debug('Metadata copied to folder: %r', self._metadata_path)
        return found
    def load(self):
        super(ConfigDriveService, self).load()

        self._preprocess_options()
        self._mgr = factory.get_config_drive_manager()
        found = self._mgr.get_config_drive_files(
            searched_types=self._searched_types,
            searched_locations=self._searched_locations)

        if found:
            self._metadata_path = self._mgr.target_path
            LOG.debug('Metadata copied to folder: %r', self._metadata_path)
        return found
    def load(self):
        super(ConfigDriveService, self).load()

        target_path = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))

        mgr = factory.get_config_drive_manager()
        found = mgr.get_config_drive_files(target_path,
                                           CONF.config_drive_raw_hhd,
                                           CONF.config_drive_cdrom)
        if found:
            self._metadata_path = target_path
            LOG.debug('Metadata copied to folder: \'%s\'' %
                      self._metadata_path)
        return found
    def load(self):
        super(ConfigDriveService, self).load()

        target_path = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))

        mgr = factory.get_config_drive_manager()
        found = mgr.get_config_drive_files(target_path,
                                           CONF.config_drive_raw_hhd,
                                           CONF.config_drive_cdrom)
        if found:
            self._metadata_path = target_path
            LOG.debug('Metadata copied to folder: \'%s\'' %
                      self._metadata_path)
        return found
    def _test_get_config_drive_manager(self, mock_load_class, platform):
        sys.platform = platform

        if platform is not "win32":
            self.assertRaises(NotImplementedError,
                              factory.get_config_drive_manager)

        else:
            response = factory.get_config_drive_manager()

            mock_load_class.assert_called_once_with(
                'cloudbaseinit.metadata.services.osconfigdrive.'
                'windows.WindowsConfigDriveManager')

            self.assertIsNotNone(response)
    def load(self):
        super(ConfigDriveService, self).load()
        # 调用预处理函数,判断路径设置是否正确
        self._preprocess_options()
        # 获取对应平台的驱动,即使用WindowsConfigDriveManager 类进行配置
        self._mgr = factory.get_config_drive_manager()
        # 找到后已将配置信息 copy 至 target_path 中
        found = self._mgr.get_config_drive_files(
            searched_types=self._searched_types,
            searched_locations=self._searched_locations)

        if found:
            # target_path 为一随机路径
            self._metadata_path = self._mgr.target_path
            LOG.debug('Metadata copied to folder: %r', self._metadata_path)
        return found
Exemple #8
0
    def _test_get_config_drive_manager(self, mock_load_class, platform):
        sys.platform = platform

        caught_notimplemented = False
        try:
            response = factory.get_config_drive_manager()
            self.assertIsNotNone(response)
        except NotImplementedError:
            caught_notimplemented = True

        if platform == 'win32':
            mock_load_class.assert_called_once_with(
                'cloudbaseinit.metadata.services.osconfigdrive.'
                'windows.WindowsConfigDriveManager')
        elif platform == 'freebsd10':
            mock_load_class.assert_called_once_with(
                'cloudbaseinit.metadata.services.osconfigdrive.'
                'freebsd.FreeBSDConfigDriveManager')
        else:
            self.assertTrue(caught_notimplemented, 'NotImplementedError expected')
Exemple #9
0
    def _test_get_config_drive_manager(self, mock_load_class, platform):
        sys.platform = platform

        caught_notimplemented = False
        try:
            response = factory.get_config_drive_manager()
            self.assertIsNotNone(response)
        except NotImplementedError:
            caught_notimplemented = True

        if platform == 'win32':
            mock_load_class.assert_called_once_with(
                'cloudbaseinit.metadata.services.osconfigdrive.'
                'windows.WindowsConfigDriveManager')
        elif platform == 'freebsd10':
            mock_load_class.assert_called_once_with(
                'cloudbaseinit.metadata.services.osconfigdrive.'
                'freebsd.FreeBSDConfigDriveManager')
        else:
            self.assertTrue(caught_notimplemented,
                            'NotImplementedError expected')