Exemplo n.º 1
0
    def delete(self, message):

        domain_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        domain = master_service.find_by_id(domain_id)
        self.sync()
    def delete(self, message):

        domain_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        domain = master_service.find_by_id(domain_id)
        self.sync()
    def update(self, message):

        domain_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        domain = master_service.find_by_id(domain_id)

        if domain is None:
            raise Exception, 'domain[%s] does not exist in the master' % (domain_id)

        # now create domain in slaves
        for slave_region in Region.objects.filter(is_master=False):
            slave_service = DomainService(slave_region)
Exemplo n.º 4
0
    def update(self, message):

        domain_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        domain = master_service.find_by_id(domain_id)

        if domain is None:
            raise Exception, 'domain[%s] does not exist in the master' % (
                domain_id)

        # now create domain in slaves
        for slave_region in Region.objects.filter(is_master=False):
            slave_service = DomainService(slave_region)
    def sync(self):

        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        master_domains = master_service.list()
        
        for slave_region in Region.objects.filter(is_master=False):

            slave_service = DomainService(slave_region)

            # create domains in the current slave
            for domain in master_domains:
                self._create(domain, slave_service)

            # delete domains not in master domain list
            slave_domains = slave_service.list()
            for domain in slave_domains:
                if self._exist(domain, master_domains) is None:
                    self._delete(domain, slave_service)
Exemplo n.º 6
0
    def create(self, message):

        user_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = UserService(master_region)
        user = master_service.find_by_id(user_id)

        if user is None:
            raise Exception, 'user[%s] does not exist in the master' % (
                user_id)

        # now create domain in slaves
        for slave_region in Region.objects.filter(is_master=False):
            slave_service = UserService(slave_region)
            slave_domain_service = DomainService(slave_region)
            self._create(user, slave_service, slave_domain_service)
Exemplo n.º 7
0
    def create(self, message):

        account_id = message['entityuuid']
        master_region = Region.objects.get(is_master=True)
        master_service = AccountService(master_region)
        account = master_service.find_by_id(account_id)

        if account is None:
            raise Exception, 'account[%s] does not exist in the master' % (
                account_id)

        # now create domain in slaves
        for slave_region in Region.objects.filter(is_master=False):
            slave_service = AccountService(slave_region)
            slave_domain_service = DomainService(slave_region)
            self._create(account, slave_service, slave_domain_service)
Exemplo n.º 8
0
    def sync(self):

        master_region = Region.objects.get(is_master=True)
        master_service = UserService(master_region)
        master_users = master_service.list()

        for slave_region in Region.objects.filter(is_master=False):

            slave_domain_service = DomainService(slave_region)
            slave_service = UserService(slave_region)

            # create users in the current slave
            for user in master_users:
                self._create(user, slave_service, slave_domain_service)

            # delete users not in master user list
            slave_users = slave_service.list()
            for user in slave_users:
                if self._exist(user, master_users) is None:
                    self._delete(user, slave_service)
Exemplo n.º 9
0
    def sync(self):

        master_region = Region.objects.get(is_master=True)
        master_service = AccountService(master_region)
        master_accounts = master_service.list()

        for slave_region in Region.objects.filter(is_master=False):

            slave_domain_service = DomainService(slave_region)
            slave_service = AccountService(slave_region)

            # create accounts in the current slave
            for account in master_accounts:
                self._create(account, slave_service, slave_domain_service)

            # delete accounts not in master account list
            slave_accounts = slave_service.list()
            for account in slave_accounts:
                if self._exist(account, master_accounts) is None:
                    self._delete(account, slave_service)
Exemplo n.º 10
0
    def sync(self):

        master_region = Region.objects.get(is_master=True)
        master_service = DomainService(master_region)
        master_domains = master_service.list()

        for slave_region in Region.objects.filter(is_master=False):

            slave_service = DomainService(slave_region)

            # create domains in the current slave
            for domain in master_domains:
                self._create(domain, slave_service)

            # delete domains not in master domain list
            slave_domains = slave_service.list()
            for domain in slave_domains:
                if self._exist(domain, master_domains) is None:
                    self._delete(domain, slave_service)