Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail on template missing parameters #1049

Merged
merged 1 commit into from Sep 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 14 additions & 17 deletions utils/saasherder.py
Expand Up @@ -309,23 +309,20 @@ def _process_template(self, options):

if "IMAGE_TAG" not in consolidated_parameters:
template_parameters = template.get('parameters')
if not template_parameters:
logging.error(
f"[{url}/{path}:{target_ref}] " +
f"missing parameters section")
return None, None
for template_parameter in template_parameters:
if template_parameter['name'] == 'IMAGE_TAG':
# add IMAGE_TAG only if it is required
get_commit_sha_options = {
'url': url,
'ref': target_ref,
'hash_length': hash_length,
'github': github
}
image_tag = self._get_commit_sha(
get_commit_sha_options)
consolidated_parameters['IMAGE_TAG'] = image_tag
if template_parameters is not None:
for template_parameter in template_parameters:
if template_parameter['name'] == 'IMAGE_TAG':
# add IMAGE_TAG only if it is required
get_commit_sha_options = {
'url': url,
'ref': target_ref,
'hash_length': hash_length,
'github': github
}
image_tag = self._get_commit_sha(
get_commit_sha_options)
consolidated_parameters['IMAGE_TAG'] = image_tag

oc = OC('server', 'token')
try:
resources = oc.process(template, consolidated_parameters)
Expand Down