upon creating a new destination, we also add it as source, if the plugin defines this as an option

This commit is contained in:
Hossein Shafagh 2019-04-11 16:39:47 -07:00
parent d7abf2ec18
commit 69c00c4db5
1 changed files with 2 additions and 3 deletions

View File

@ -12,7 +12,7 @@ from lemur import database
from lemur.models import certificate_destination_associations from lemur.models import certificate_destination_associations
from lemur.destinations.models import Destination from lemur.destinations.models import Destination
from lemur.certificates.models import Certificate from lemur.certificates.models import Certificate
from lemur.sources import service as sources_service from lemur.sources.service import add_aws_destination_to_sources
def create(label, plugin_name, options, description=None): def create(label, plugin_name, options, description=None):
@ -33,8 +33,7 @@ def create(label, plugin_name, options, description=None):
current_app.logger.info("Destination: %s created", label) current_app.logger.info("Destination: %s created", label)
# add the destination as source, to avoid new destinations that are not in source, as long as an AWS destination # add the destination as source, to avoid new destinations that are not in source, as long as an AWS destination
if plugin_name == 'aws-destination': if add_aws_destination_to_sources(destination):
sources_service.create(label=label, plugin_name='aws-source', options=options, description=description)
current_app.logger.info("Source: %s created", label) current_app.logger.info("Source: %s created", label)
return database.create(destination) return database.create(destination)