From e7f69ab6727edd1854aad3d0eaa9eca547d0c9fc Mon Sep 17 00:00:00 2001 From: Claudio Pisa <claudio.pisa@garr.it> Date: Thu, 21 Feb 2019 17:45:53 +0100 Subject: [PATCH] 2019-02-21: CP; use the whole path for the output files --- generate-files-for-simplestream.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/generate-files-for-simplestream.py b/generate-files-for-simplestream.py index fa161e4..f7e3861 100755 --- a/generate-files-for-simplestream.py +++ b/generate-files-for-simplestream.py @@ -5,8 +5,9 @@ import shade import yaml import json import time +import pathlib -OUTPUT_DIR="./output/" +OUTPUT_DIR="./output/simplestreams/images/streams/v1/" REGIONS = ['garr-pa1', 'garr-ct1'] KEYSTONE_ENDPOINT = "https://keystone.cloud.garr.it:5000/v3" @@ -15,6 +16,9 @@ with open('config.yml') as fh_config: config = yaml.load(fh_config) fh_config.close() +# create the output directory +pathlib.Path(OUTPUT_DIR).mkdir(parents=True, exist_ok=True) + openstack_cloud_connection = shade.openstack_cloud() simplestream_images = [] @@ -30,7 +34,7 @@ for image_key in sorted(config['images'].keys()): element['arch'] = element['simplestreams_name'].split(':')[-1] element['version'] = element['simplestreams_name'].split(':')[-2] simplestream_images.append(element) -print(yaml.dump({'simplestream_images': simplestream_images}, default_flow_style=False)) +print(simplestream_images) now = time.strftime('%a, %d %b %Y %H:%M:%S %z') today = time.strftime('%Y%m%d') @@ -78,3 +82,6 @@ metadata['content_id'] = "com.ubuntu.cloud:custom" with open(OUTPUT_DIR + "com.ubuntu.cloud-released-imagemetadata.json", 'w') as metadata_json: json.dump(metadata, metadata_json, indent=4) +print("\n\nThe simplestream files have been generated in the output directory.\nYou can now upload them to the object store.") + + -- GitLab