You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by lf...@apache.org on 2020/02/20 14:54:07 UTC

[incubator-dlab] 01/03: DLAB-1531 fixed errors

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

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

commit 27f91b67ee8f5d93520aa0ac3af7be58164550bf
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Feb 20 16:19:15 2020 +0200

    DLAB-1531 fixed errors
---
 .../src/general/lib/aws/actions_lib.py                     | 14 ++------------
 .../src/general/scripts/gcp/common_create_bucket.py        |  2 +-
 .../src/general/scripts/gcp/project_prepare.py             |  4 ++--
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index af6412c..d094ec5 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -66,7 +66,7 @@ def put_to_bucket(bucket_name, local_file, destination_file):
         return False
 
 
-def create_s3_bucket(bucket_name, bucket_tags, region, bucket_name_tag):
+def create_s3_bucket(bucket_name, bucket_tags, region):
     try:
         s3 = boto3.resource('s3', config=Config(signature_version='s3v4'))
         if region == "us-east-1":
@@ -83,18 +83,8 @@ def create_s3_bucket(bucket_name, bucket_tags, region, bucket_name_tag):
                     },
                 ]
             })
-        tags = list()
-        tags.append({'Key': os.environ['conf_tag_resource_id'],
-                     'Value': os.environ['conf_service_base_name'] + ':' + bucket_name_tag})
-        for tag in bucket_tags.split(';'):
-            tags.append(
-                {
-                    'Key': tag.split(':')[0],
-                    'Value': tag.split(':')[1]
-                }
-            )
         tagging = bucket.Tagging()
-        tagging.put(Tagging={'TagSet': tags})
+        tagging.put(Tagging={'TagSet': bucket_tags})
         tagging.reload()
         return bucket.name
     except Exception as err:
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/common_create_bucket.py b/infrastructure-provisioning/src/general/scripts/gcp/common_create_bucket.py
index 5291d9a..1ac223f 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/common_create_bucket.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/common_create_bucket.py
@@ -41,7 +41,7 @@ if __name__ == "__main__":
         else:
             print("Creating Bucket {}".format(args.bucket_name))
             GCPActions().create_bucket(args.bucket_name)
-            GCPActions().add_bucket_labels(args.bucket_name, args.tags)
+            GCPActions().add_bucket_labels(args.bucket_name, json.loads(args.tags))
     else:
         parser.print_help()
         sys.exit(2)
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/project_prepare.py b/infrastructure-provisioning/src/general/scripts/gcp/project_prepare.py
index b25975d..5b44d66 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/project_prepare.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/project_prepare.py
@@ -371,7 +371,7 @@ if __name__ == "__main__":
             "endpoint_tag": project_conf['endpoint_tag'],
             os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value'],
             "sbn": project_conf['service_base_name']}
-        params = "--bucket_name {} --tags {}".format(project_conf['shared_bucket_name'], project_conf['shared_bucket_tags'])
+        params = "--bucket_name {} --tags '{}'".format(project_conf['shared_bucket_name'], json.dumps(project_conf['shared_bucket_tags']))
         try:
             local("~/scripts/{}.py {}".format('common_create_bucket', params))
         except:
@@ -384,7 +384,7 @@ if __name__ == "__main__":
             os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value'],
             "sbn": project_conf['service_base_name'],
             "project_tag": project_conf['project_tag']}
-        params = "--bucket_name {} --tags {}".format(project_conf['bucket_name'], project_conf['bucket_tags'])
+        params = "--bucket_name {} --tags '{}'".format(project_conf['bucket_name'], json.dumps(project_conf['bucket_tags']))
 
         try:
             local("~/scripts/{}.py {}".format('common_create_bucket', params))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org