From cd63dc4dc1ae70152d2d3a4750f2a1e42c005683 Mon Sep 17 00:00:00 2001 From: Ethan Moore Date: Mon, 23 Nov 2015 19:35:11 +0000 Subject: [PATCH] Add check to require vpc_id and vpc_region for private zones Add parameter documentation for create_zone function --- salt/modules/boto_route53.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/salt/modules/boto_route53.py b/salt/modules/boto_route53.py index 8d265fdd40..c3a4e39554 100644 --- a/salt/modules/boto_route53.py +++ b/salt/modules/boto_route53.py @@ -55,6 +55,7 @@ import time # Import salt libs import salt.utils.compat import salt.utils.odict as odict +from salt.exceptions import SaltInvocationError log = logging.getLogger(__name__) @@ -145,6 +146,30 @@ def create_zone(zone, private=False, vpc_id=None, vpc_region=None, region=None, .. versionadded:: 2015.8.0 + zone + DNZ zone to create + + private + True/False if the zone will be a private zone + + vpc_id + VPC ID to associate the zone to (required if private is True) + + vpc_region + VPC Region (required if private is True) + + region + region endpoint to connect to + + key + AWS key + + keyid + AWS keyid + + profile + AWS pillar profile + CLI Example:: salt myminion boto_route53.create_zone example.org @@ -152,6 +177,11 @@ def create_zone(zone, private=False, vpc_id=None, vpc_region=None, region=None, if region is None: region = 'universal' + if private: + if not vpc_id and not vpc_region: + msg = 'vpc_id and vpc_region must be specified for a private zone' + raise SaltInvocationError(msg) + conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) _zone = conn.get_zone(zone)