diff --git a/generate-files-for-simplestream.py b/generate-files-for-simplestream.py index fa161e4a865a3260e766c15607aaaf2ca803186a..f7e3861afb2971917baa1c17ba3b77bc9fdc87e9 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.") + +