Exemplo n.º 1
0
    def _generate_shared_ssl_domain(self, domain_name, store):
        try:
            if not hasattr(self, store):
                gen_store = {
                    domain_name:
                    self.dns_controller.generate_shared_ssl_domain_suffix()
                }
                setattr(self, store, gen_store)
            uuid_store = getattr(self, store)
            if domain_name not in uuid_store:
                uuid_store[domain_name] = \
                    self.dns_controller.generate_shared_ssl_domain_suffix()
                setattr(self, store, uuid_store)

            shard = next(uuid_store[domain_name])
            while self.dns_controller.is_shard_full(shard):
                LOG.info("Skipped shard {0} because it's at maximum capacity.".
                         format(shard))
                shard = next(uuid_store[domain_name])

            return '.'.join([domain_name, shard])
        except StopIteration:
            delattr(self, store)
            raise errors.SharedShardsExhausted(
                'Domain {0} has already been taken'.format(domain_name))
Exemplo n.º 2
0
 def _generate_shared_ssl_domain(self, domain_name, store):
     try:
         if not hasattr(self, store):
             gen_store = {
                 domain_name:
                 self.dns_controller.generate_shared_ssl_domain_suffix()
             }
             setattr(self, store, gen_store)
         uuid_store = getattr(self, store)
         if domain_name not in uuid_store:
             uuid_store[domain_name] = \
                 self.dns_controller.generate_shared_ssl_domain_suffix()
             setattr(self, store, uuid_store)
         return '.'.join([domain_name, next(uuid_store[domain_name])])
     except StopIteration:
         delattr(self, store)
         raise errors.SharedShardsExhausted('Domain {0} '
                                            'has already '
                                            'been '
                                            'taken'.format(domain_name))