You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by om...@apache.org on 2019/04/08 14:05:35 UTC
[incubator-dlab] branch DLAB-594 updated: [DLAB-594]: fixed issue
with creating IAM role and added tag for peering connection
This is an automated email from the ASF dual-hosted git repository.
omartushevskyi pushed a commit to branch DLAB-594
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-594 by this push:
new e506e4b [DLAB-594]: fixed issue with creating IAM role and added tag for peering connection
e506e4b is described below
commit e506e4bce2e2618ab051cbef4e781be98aed645d
Author: Oleh Martushevskyi <Ol...@epam.com>
AuthorDate: Mon Apr 8 17:05:26 2019 +0300
[DLAB-594]: fixed issue with creating IAM role and added tag for peering connection
---
infrastructure-provisioning/src/general/lib/aws/actions_lib.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index 9d10c5a..0a41509 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -338,6 +338,7 @@ def create_peering_connection(vpc_id, vpc2_id, service_base_name):
ec2 = boto3.resource('ec2')
client = boto3.client('ec2')
tag = {"Key": service_base_name + '-Tag', "Value": service_base_name}
+ tag_name = {"Key": 'Name', "Value": "{0}-peering-connection".format(service_base_name)}
peering = ec2.create_vpc_peering_connection(PeerVpcId=vpc_id, VpcId=vpc2_id)
client.accept_vpc_peering_connection(VpcPeeringConnectionId=peering.id)
client.modify_vpc_peering_connection_options(
@@ -350,6 +351,7 @@ def create_peering_connection(vpc_id, vpc2_id, service_base_name):
VpcPeeringConnectionId=peering.id
)
create_tag(peering.id, json.dumps(tag))
+ create_tag(peering.id, json.dumps(tag_name))
return peering.id
except Exception as err:
logging.info("Unable to create peering connection: " + str(err) + "\n Traceback: " + traceback.print_exc(
@@ -513,7 +515,6 @@ def create_iam_role(role_name, role_profile, region, service='ec2', tag=None):
'.amazonaws.com"]},"Action":["sts:AssumeRole"]}]}')
if tag:
conn.tag_role(RoleName=role_name, Tags=[tag])
- conn.tag_role(RoleName=role_name, Tags=[{"Key": "Name", "Value": role_name}])
except botocore.exceptions.ClientError as e_role:
if e_role.response['Error']['Code'] == 'EntityAlreadyExists':
print("IAM role already exists. Reusing...")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org