import logging

logger = logging.getLogger(__name__)


from aws_helper.connection import ConnectionManager

from stacker.util import create_route53_zone


def create_domain(region, namespace, mappings, parameters, **kwargs):
    conn = ConnectionManager(region)
    try:
        domain = parameters['BaseDomain']
    except KeyError:
        logger.error("BaseDomain parameter not provided.")
        return False
    create_route53_zone(conn.route53, domain)
    return True

import logging

logger = logging.getLogger(__name__)


from aws_helper.connection import ConnectionManager

from stacker.util import create_route53_zone


def create_domain(region, namespace, mappings, parameters, **kwargs):
    conn = ConnectionManager(region)
    domain = kwargs.get('domain', parameters.get('BaseDomain'))
    if not domain:
        logger.error("domain argument or BaseDomain parameter not provided.")
        return False
    create_route53_zone(conn.route53, domain)
    return True

Allow creation of domains without BaseDomain
Allow creation of domains without BaseDomain

Gives the hook the ability to parse args.

  import logging
  
  logger = logging.getLogger(__name__)
  
  
  from aws_helper.connection import ConnectionManager
  
  from stacker.util import create_route53_zone
  
  
  def create_domain(region, namespace, mappings, parameters, **kwargs):
      conn = ConnectionManager(region)
+     domain = kwargs.get('domain', parameters.get('BaseDomain'))
+     if not domain:
-     try:
-         domain = parameters['BaseDomain']
-     except KeyError:
-         logger.error("BaseDomain parameter not provided.")
+         logger.error("domain argument or BaseDomain parameter not provided.")
          return False
      create_route53_zone(conn.route53, domain)
      return True
  
Allow creation of domains without BaseDomain
## Code Before:
import logging

logger = logging.getLogger(__name__)


from aws_helper.connection import ConnectionManager

from stacker.util import create_route53_zone


def create_domain(region, namespace, mappings, parameters, **kwargs):
    conn = ConnectionManager(region)
    try:
        domain = parameters['BaseDomain']
    except KeyError:
        logger.error("BaseDomain parameter not provided.")
        return False
    create_route53_zone(conn.route53, domain)
    return True

## Instruction:
Allow creation of domains without BaseDomain
## Code After:
import logging

logger = logging.getLogger(__name__)


from aws_helper.connection import ConnectionManager

from stacker.util import create_route53_zone


def create_domain(region, namespace, mappings, parameters, **kwargs):
    conn = ConnectionManager(region)
    domain = kwargs.get('domain', parameters.get('BaseDomain'))
    if not domain:
        logger.error("domain argument or BaseDomain parameter not provided.")
        return False
    create_route53_zone(conn.route53, domain)
    return True
