mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #20722 from claudiupopescu/boto-vpc-dns-support
Adding DNS support to boto vpc creation
This commit is contained in:
commit
bc67e2e9c9
@ -219,8 +219,9 @@ def exists(vpc_id=None, name=None, cidr=None, tags=None, region=None, key=None,
|
||||
return False
|
||||
|
||||
|
||||
def create(cidr_block, instance_tenancy=None, vpc_name=None, tags=None, region=None, key=None, keyid=None,
|
||||
profile=None):
|
||||
def create(cidr_block, instance_tenancy=None, vpc_name=None,
|
||||
enable_dns_support=None, enable_dns_hostnames=None, tags=None,
|
||||
region=None, key=None, keyid=None, profile=None):
|
||||
'''
|
||||
Given a valid CIDR block, create a VPC.
|
||||
|
||||
@ -248,6 +249,7 @@ def create(cidr_block, instance_tenancy=None, vpc_name=None, tags=None, region=N
|
||||
|
||||
_maybe_set_name_tag(vpc_name, vpc)
|
||||
_maybe_set_tags(tags, vpc)
|
||||
_maybe_set_dns(conn, vpc.id, enable_dns_support, enable_dns_hostnames)
|
||||
|
||||
return vpc.id
|
||||
else:
|
||||
@ -1327,3 +1329,12 @@ def _maybe_set_tags(tags, obj):
|
||||
obj.add_tags(tags)
|
||||
|
||||
log.debug('The following tags: {0} were added to {1}'.format(', '.join(tags), obj))
|
||||
|
||||
|
||||
def _maybe_set_dns(conn, vpcid, dns_support, dns_hostnames):
|
||||
if dns_support:
|
||||
conn.modify_vpc_attribute(vpc_id=vpcid, enable_dns_support=dns_support)
|
||||
log.debug('DNS spport was set to: {0} on vpc {1}'.format(dns_support, vpcid))
|
||||
if dns_hostnames:
|
||||
conn.modify_vpc_attribute(vpc_id=vpcid, enable_dns_hostnames=dns_hostnames)
|
||||
log.debug('DNS hostnames was set to: {0} on vpc {1}'.format(dns_hostnames, vpcid))
|
||||
|
Loading…
Reference in New Issue
Block a user