Пример #1
0
    def _create_owned_appserver(self):
        """
        Core internal code that actually creates the child appserver.

        The only reason this is separated from the public spawn_appserver() method is so that
        tests can use this core code as an AppServer factory.

        This method should never be used directly, except in tests.
        Use spawn_appserver() instead.
        """
        config_fields = OpenEdXAppConfiguration.get_config_fields()
        instance_config = {
            field_name: getattr(self, field_name)
            for field_name in config_fields
        }

        with transaction.atomic():
            app_server = self.appserver_set.create(
                # Name for the app server: this will usually generate a unique name (and won't cause any issues if not):
                name="AppServer {}".format(self.appserver_set.count() + 1),
                # Copy the current value of each setting into the AppServer, preserving it permanently:
                configuration_database_settings=self.get_database_settings(),
                configuration_storage_settings=self.get_storage_settings(),
                configuration_theme_settings=self.get_theme_settings(),
                configuration_secret_keys=self.get_secret_key_settings(),
                **instance_config)
            app_server.add_lms_users(self.lms_users.all())
        return app_server
Пример #2
0
    def _create_owned_appserver(self):
        """
        Core internal code that actually creates the child appserver.

        The only reason this is separated from the public spawn_appserver() method is so that
        tests can use this core code as an AppServer factory.

        This method should never be used directly, except in tests.
        Use spawn_appserver() instead.
        """
        config_fields = OpenEdXAppConfiguration.get_config_fields()
        instance_config = {field_name: getattr(self, field_name) for field_name in config_fields}

        with transaction.atomic():
            app_server = self.appserver_set.create(
                # Name for the app server: this will usually generate a unique name (and won't cause any issues if not):
                name="AppServer {}".format(self.appserver_set.count() + 1),
                # Copy the current value of each setting into the AppServer, preserving it permanently:
                configuration_database_settings=self.get_database_settings(),
                configuration_storage_settings=self.get_storage_settings(),
                configuration_secret_keys=self.get_secret_key_settings(),
                **instance_config
            )
            app_server.add_lms_users(self.lms_users.all())
        return app_server
Пример #3
0
 class Meta:
     model = OpenEdXAppServer
     fields = tuple(OpenEdXAppConfiguration.get_config_fields()) + (
         'configuration_database_settings',
         'configuration_storage_settings',
         'configuration_settings',
         'instance',
         'server',
     )