Example #1
0
from instance import ansible
from instance.logging import log_exception
from instance.models.appserver import AppServer
from instance.models.mixins.ansible import AnsibleAppServerMixin, Playbook
from instance.models.mixins.utilities import EmailMixin
from instance.models.mixins.openedx_config import OpenEdXConfigMixin
from instance.models.utils import default_setting, format_help_text
from instance.openstack_utils import get_openstack_connection, sync_security_group_rules, SecurityGroupRuleDefinition
from userprofile.models import UserProfile

# Constants ###################################################################

# OpenStack firewall rules (security group rules) to apply to the main security group of each AppServer:
OPENEDX_APPSERVER_SECURITY_GROUP_RULES = [
    # Convert this setting from a list of dicts to a list of SecurityGroupRuleDefinition tuples.
    SecurityGroupRuleDefinition(**rule)
    for rule in settings.OPENEDX_APPSERVER_SECURITY_GROUP_RULES
]

# Models ######################################################################


class OpenEdXAppConfiguration(models.Model):
    """
    Configuration fields used by OpenEdX Instance and AppServer.

    Mutable on the instance but immutable on the AppServer.
    """
    class Meta:
        abstract = True
Example #2
0
from instance.models.appserver import AppServer
from instance.models.mixins.ansible import AnsibleAppServerMixin, Playbook
from instance.models.mixins.utilities import EmailMixin
from instance.models.mixins.openedx_config import OpenEdXConfigMixin
from instance.models.utils import default_setting, format_help_text, get_base_playbook_name
from instance.openstack_utils import get_openstack_connection, sync_security_group_rules, SecurityGroupRuleDefinition
from instance.utils import publish_data
from userprofile.models import UserProfile

# Constants ###################################################################


# OpenStack firewall rules (security group rules) to apply to the main security group of each AppServer:
OPENEDX_APPSERVER_SECURITY_GROUP_RULES = [
    # Convert this setting from a list of dicts to a list of SecurityGroupRuleDefinition tuples.
    SecurityGroupRuleDefinition(**rule) for rule in settings.OPENEDX_APPSERVER_SECURITY_GROUP_RULES
]


# Models ######################################################################

class OpenEdXAppConfiguration(models.Model):
    """
    Configuration fields used by OpenEdX Instance and AppServer.

    Mutable on the instance but immutable on the AppServer.
    """
    class Meta:
        abstract = True

    email = models.EmailField(default='*****@*****.**', help_text=(