Add hypen to the prefix/suffix of container name if not provided

If suffix is provided without hypen at the start, prefix hypen
to the suffix, to support creation of image names like
openstack-nova-compute-docker, where docker is the suffix.
Also if prefix is provided without hypen at the end, add hypen
at the end of the prefix.
Closes-Bug: #1709777

Change-Id: I2330a6f35a12bf140da8b52114cb20844efc5554
This commit is contained in:
Saravanan KR 2017-08-10 11:40:48 +05:30
parent 3a0ad22bb7
commit 7f79a55edc
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,17 @@
{% set namespace=namespace or "tripleoupstream" %}
{% if name_prefix and not name_prefix.endswith('-') %}
{% set name_prefix=name_prefix + "-" %}
{% else %}
{% set name_prefix=name_prefix or "centos-binary-" %}
{% endif %}
{% if name_suffix and not name_suffix.startswith('-') %}
{% set name_suffix="-" + name_suffix %}
{% else %}
{% set name_suffix=name_suffix or "" %}
{% endif %}
{% set tag=tag or "latest" %}
container_images_template:
- imagename: "{{namespace}}/{{name_prefix}}aodh-api{{name_suffix}}:{{tag}}"