Skip to content

Commit

Permalink
Merge pull request #25312 from ruzarowski/2015.8-Introduce-eni-Name-p…
Browse files Browse the repository at this point in the history
…roperty-to-set-name-tag-value-after-its-creation

[cloud:EC2] Introduce eni Name property to set name tag value after its creation
  • Loading branch information
Nicole Thomas committed Jul 13, 2015
2 parents b16d86a + 47ba4f2 commit e5d7ba0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions salt/cloud/clouds/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,20 @@ def _create_eni_if_necessary(interface):
for idx, addr in enumerate(addr_list):
_associate_eip_with_interface(eni_id, eip_list[idx], addr)

if 'Name' in interface:
tag_params = {'Action': 'CreateTags',
'ResourceId.0': eni_id,
'Tag.0.Key': 'Name',
'Tag.0.Value': interface['Name']}
tag_response = aws.query(tag_params,
return_root=True,
location=get_location(),
provider=get_provider(),
opts=__opts__,
sigver='4')
if 'error' in tag_response:
log.error('Failed to set name of interface {0}')

return {'DeviceIndex': interface['DeviceIndex'],
'NetworkInterfaceId': eni_id}

Expand Down

0 comments on commit e5d7ba0

Please sign in to comment.