def create_ssl_certificate(self, project_id, cert_obj): if (not validators.is_valid_domain_name(cert_obj.domain_name)) or \ (validators.is_root_domain( domain.Domain(cert_obj.domain_name).to_dict())): # here created a http domain object but it does not matter http or # https raise ValueError('%s must be a valid non-root domain' % cert_obj.domain_name) try: flavor = self.flavor_controller.get(cert_obj.flavor_id) # raise a lookup error if the flavor is not found except LookupError as e: raise e try: self.storage.create_certificate(project_id, cert_obj) # ValueError will be raised if the cert_info has already existed except ValueError as e: raise e providers = [p.provider_id for p in flavor.providers] kwargs = { 'providers_list_json': json.dumps(providers), 'project_id': project_id, 'cert_obj_json': json.dumps(cert_obj.to_dict()), 'context_dict': context_utils.get_current().to_dict() } self.distributed_task_controller.submit_task( create_ssl_certificate.create_ssl_certificate, **kwargs) return kwargs
def create_ssl_certificate(self, project_id, cert_obj): if (not validators.is_valid_domain_name(cert_obj.domain_name)) or \ (validators.is_root_domain( domain.Domain(cert_obj.domain_name).to_dict())): # here created a http domain object but it does not matter http or # https raise ValueError('%s must be a valid non-root domain' % cert_obj.domain_name) try: flavor = self.flavor_controller.get(cert_obj.flavor_id) # raise a lookup error if the flavor is not found except LookupError as e: raise e try: self.storage_controller.create_cert( project_id, cert_obj) # ValueError will be raised if the cert_info has already existed except ValueError as e: raise e providers = [p.provider_id for p in flavor.providers] kwargs = { 'providers_list_json': json.dumps(providers), 'project_id': project_id, 'cert_obj_json': json.dumps(cert_obj.to_dict()), 'context_dict': context_utils.get_current().to_dict() } self.distributed_task_controller.submit_task( create_ssl_certificate.create_ssl_certificate, **kwargs) return kwargs