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/11 11:48:00 UTC

[incubator-dlab] 01/01: [DLAB-600]: Fixed issue with missed tags

This is an automated email from the ASF dual-hosted git repository.

omartushevskyi pushed a commit to branch DLAB-600
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 22aba18e80f4b31e28c3991592372f0dbfd1409f
Author: Oleh Martushevskyi <Ol...@epam.com>
AuthorDate: Thu Apr 11 14:47:51 2019 +0300

    [DLAB-600]: Fixed issue with missed tags
---
 infrastructure-provisioning/src/general/lib/aws/actions_lib.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index 2f21233..fb674f2 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -249,6 +249,9 @@ def create_security_group(security_group_name, vpc_id, security_group_rules, egr
         time.sleep(10)
         create_tag(group.id, tag)
         create_tag(group.id, tag_name)
+        if 'conf_billing_tag_key' in os.environ and 'conf_billing_tag_value' in os.environ:
+            create_tag(group.id, {'Key': os.environ['conf_billing_tag_key'],
+                                  'Value': os.environ['conf_billing_tag_value']})
         try:
             group.revoke_egress(IpPermissions=[{"IpProtocol": "-1", "IpRanges": [{"CidrIp": "0.0.0.0/0"}],
                                                 "UserIdGroupPairs": [], "PrefixListIds": []}])
@@ -516,6 +519,9 @@ def create_iam_role(role_name, role_profile, region, service='ec2', tag=None):
         if tag:
             conn.tag_role(RoleName=role_name, Tags=[tag])
             conn.tag_role(RoleName=role_name, Tags=[{"Key": "Name", "Value": role_name}])
+            if 'conf_billing_tag_key' in os.environ and 'conf_billing_tag_value' in os.environ:
+                conn.tag_role(RoleName=role_name, Tags=[{'Key': os.environ['conf_billing_tag_key'],
+                                                         'Value': os.environ['conf_billing_tag_value']}])
     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