summaryrefslogtreecommitdiff
path: root/scripts/emit_releases_file/emit_releases_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/emit_releases_file/emit_releases_file.py')
-rw-r--r--scripts/emit_releases_file/emit_releases_file.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/scripts/emit_releases_file/emit_releases_file.py b/scripts/emit_releases_file/emit_releases_file.py
index f18f417..f6c936d 100644
--- a/scripts/emit_releases_file/emit_releases_file.py
+++ b/scripts/emit_releases_file/emit_releases_file.py
@@ -43,8 +43,8 @@ def load_featureset_file(featureset_file):
43def get_dlrn_hash(release, hash_name, retries=10): 43def get_dlrn_hash(release, hash_name, retries=10):
44 logger = logging.getLogger('emit-releases') 44 logger = logging.getLogger('emit-releases')
45 full_hash_pattern = re.compile('[a-z,0-9]{40}_[a-z,0-9]{8}') 45 full_hash_pattern = re.compile('[a-z,0-9]{40}_[a-z,0-9]{8}')
46 repo_url = ('https://trunk.rdoproject.org/centos7-%s/%s/delorean.repo' 46 repo_url = ('https://trunk.rdoproject.org/centos7-%s/%s/delorean.repo' %
47 % (release, hash_name)) 47 (release, hash_name))
48 for retry_num in range(retries): 48 for retry_num in range(retries):
49 repo_file = None 49 repo_file = None
50 # Timeout if initial connection is longer than default 50 # Timeout if initial connection is longer than default
@@ -155,6 +155,28 @@ def shim_convert_old_release_names(releases_names):
155 return releases_names 155 return releases_names
156 156
157 157
158def write_releases_dictionary_to_bash(releases_dictionary, bash_file_name):
159 logger = logging.getLogger('emit-releases')
160 # Make it deterministic, expected constants in the proper order
161 try:
162 bash_script = '''#!/bin/env bash
163export UNDERCLOUD_INSTALL_RELEASE="{undercloud_install_release}"
164export UNDERCLOUD_INSTALL_HASH="{undercloud_install_hash}"
165export UNDERCLOUD_TARGET_RELEASE="{undercloud_target_release}"
166export UNDERCLOUD_TARGET_HASH="{undercloud_target_hash}"
167export OVERCLOUD_DEPLOY_RELEASE="{overcloud_deploy_release}"
168export OVERCLOUD_DEPLOY_HASH="{overcloud_deploy_hash}"
169export OVERCLOUD_TARGET_RELEASE="{overcloud_target_release}"
170export OVERCLOUD_TARGET_HASH="{overcloud_target_hash}"
171'''.format(**releases_dictionary)
172 with open(bash_file_name, 'w') as bash_file:
173 bash_file.write(bash_script)
174 except Exception:
175 logger.exception("Writting releases dictionary")
176 return False
177 return True
178
179
158if __name__ == '__main__': 180if __name__ == '__main__':
159 181
160 default_log_file = '{}.log'.format(os.path.basename(__file__)) 182 default_log_file = '{}.log'.format(os.path.basename(__file__))
@@ -193,5 +215,8 @@ if __name__ == '__main__':
193 releases_dictionary = compose_releases_dictionary(args.stable_release, 215 releases_dictionary = compose_releases_dictionary(args.stable_release,
194 featureset) 216 featureset)
195 217
196 releases_dictionary = shim_convert_old_release_names( 218 releases_dictionary = shim_convert_old_release_names(releases_dictionary)
197 releases_dictionary) 219
220 if not write_releases_dictionary_to_bash(
221 releases_dictionary, args.output_file):
222 exit(1)