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:08 UTC
[incubator-dlab] 02/03: DLAB-1531 changed for testing
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 bd48194568d3180406e3c63cc97f198587ab73a5
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Feb 20 16:22:42 2020 +0200
DLAB-1531 changed for testing
---
.../general/scripts/aws/common_create_bucket.py | 3 +--
.../src/general/scripts/aws/project_prepare.py | 28 ++++++++++++++--------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/infrastructure-provisioning/src/general/scripts/aws/common_create_bucket.py b/infrastructure-provisioning/src/general/scripts/aws/common_create_bucket.py
index 207af06..71a5456 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/common_create_bucket.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/common_create_bucket.py
@@ -32,7 +32,6 @@ parser = argparse.ArgumentParser()
parser.add_argument('--bucket_name', type=str, default='')
parser.add_argument('--bucket_tags', type=str, default='')
parser.add_argument('--region', type=str, default='')
-parser.add_argument('--bucket_name_tag', type=str, default='')
args = parser.parse_args()
@@ -42,7 +41,7 @@ if __name__ == "__main__":
bucket = get_bucket_by_name(args.bucket_name)
if bucket == '':
print("Creating bucket {0} with tags {1}.".format(args.bucket_name, args.bucket_tags))
- bucket = create_s3_bucket(args.bucket_name, args.bucket_tags, args.region, args.bucket_name_tag)
+ bucket = create_s3_bucket(args.bucket_name, args.bucket_tags, args.region)
else:
print("REQUESTED BUCKET ALREADY EXISTS")
print("BUCKET_NAME {}".format(bucket))
diff --git a/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py b/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
index b8fb85d..d04eedb 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
@@ -134,7 +134,7 @@ if __name__ == "__main__":
logging.info(json.dumps(project_conf))
if 'conf_additional_tags' in os.environ:
- project_conf['bucket_additional_tags'] = os.environ['conf_additional_tags'] + ';'
+ project_conf['bucket_additional_tags'] = ';' + os.environ['conf_additional_tags']
os.environ['conf_additional_tags'] = os.environ['conf_additional_tags'] + \
';project_tag:{0};endpoint_tag:{1};'.format(
project_conf['project_tag'], project_conf['endpoint_tag'])
@@ -533,22 +533,30 @@ if __name__ == "__main__":
try:
logging.info('[CREATE BUCKETS]')
print('[CREATE BUCKETS]')
- project_conf['shared_bucket_tags'] = 'endpoint_tag:{};{}:{};{}:{};{}'.format(project_conf['endpoint_tag'],
+ tags = list()
+ tags.append({'Key': os.environ['conf_tag_resource_id'],
+ 'Value': os.environ['conf_service_base_name'] + ':' + project_conf['shared_bucket_name_tag']})
+ project_conf['shared_bucket_tags'] = 'endpoint_tag:{};{}:{};{}:{}{}'.format(project_conf['endpoint_tag'],
os.environ['conf_billing_tag_key'], os.environ['conf_billing_tag_value'],
project_conf['tag_name'], project_conf['shared_bucket_name'], project_conf['bucket_additional_tags'])
- params = "--bucket_name {} --bucket_tags {} --region {} --bucket_name_tag {}". \
- format(project_conf['shared_bucket_name'], project_conf['shared_bucket_tags'], project_conf['region'], project_conf['shared_bucket_name_tag'])
+ for tag in project_conf['shared_bucket_tags'].split(';'):
+ tags.append(
+ {
+ 'Key': tag.split(':')[0],
+ 'Value': tag.split(':')[1]
+ }
+ )
+ params = "--bucket_name {} --bucket_tags '{}' --region {}". \
+ format(project_conf['shared_bucket_name'], tags, project_conf['region'])
try:
local("~/scripts/{}.py {}".format('common_create_bucket', params))
except:
traceback.print_exc()
raise Exception
- project_conf['bucket_tags'] = 'endpoint_tag:{};{}:{};project_tag:{};{}:{};{}'.format(project_conf['endpoint_tag'],
- os.environ['conf_billing_tag_key'], os.environ['conf_billing_tag_value'],
- project_conf['project_tag'],
- project_conf['tag_name'], project_conf['bucket_name'], project_conf['bucket_additional_tags'])
- params = "--bucket_name {} --bucket_tags {} --region {} --bucket_name_tag {}" \
- .format(project_conf['bucket_name'], project_conf['tag_name'], project_conf['region'], project_conf['bucket_name_tag'])
+ tags.append({'Key': 'project_tag',
+ 'Value': project_conf['project_tag']})
+ params = "--bucket_name {} --bucket_tags '{}' --region {}" \
+ .format(project_conf['bucket_name'], tags, project_conf['region'])
try:
local("~/scripts/{}.py {}".format('common_create_bucket', params))
except:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org