Fix parsing of DockerCephDaemonImage parameter

Splitting by colon using native str_split function did not work well
because we needed a right split.

This change replaces the str_split calls with yaql rightSplit().

Change-Id: Iab2f69a5fadc6b02e2eacf3c9d1a9024b0212ac6
This commit is contained in:
Giulio Fidente 2017-08-08 13:25:27 +02:00 committed by Emilien Macchi
parent ac16b57460
commit 6e352e3911

View File

@ -102,6 +102,33 @@ conditions:
data: {get_param: DockerCephDaemonImage} data: {get_param: DockerCephDaemonImage}
expression: $.data.split('/')[0].matches('(\.|:)') expression: $.data.split('/')[0].matches('(\.|:)')
resources:
DockerImageUrlParts:
type: OS::Heat::Value
properties:
type: json
value:
host:
if:
- custom_registry_host
- yaql:
expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[1]
data: {get_param: DockerCephDaemonImage}
- docker.io
image:
if:
- custom_registry_host
- yaql:
expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[2]
data: {get_param: DockerCephDaemonImage}
- yaql:
expression: $.data.rightSplit(':', 1)[0]
data: {get_param: DockerCephDaemonImage}
image_tag:
yaql:
expression: $.data.rightSplit(':', 1)[1]
data: {get_param: DockerCephDaemonImage}
outputs: outputs:
role_data: role_data:
description: Role data for the Ceph base service. description: Role data for the Ceph base service.
@ -125,21 +152,9 @@ outputs:
ceph_common_ansible_vars: ceph_common_ansible_vars:
fsid: { get_param: CephClusterFSID } fsid: { get_param: CephClusterFSID }
docker: true docker: true
ceph_docker_registry: ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
if: ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
- custom_registry_host ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
- yaql:
expression: regex('(?:https?://)?(.*)/').split($.data)[1]
data: {str_split: [':', {get_param: DockerCephDaemonImage}, 0]}
- docker.io
ceph_docker_image:
if:
- custom_registry_host
- yaql:
expression: regex('(?:https?://)?(.*)/').split($.data)[2]
data: {str_split: [':', {get_param: DockerCephDaemonImage}, 0]}
- {str_split: [':', {get_param: DockerCephDaemonImage}, 0]}
ceph_docker_image_tag: {str_split: [':', {get_param: DockerCephDaemonImage}, 1]}
containerized_deployment: true containerized_deployment: true
public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]} public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]} cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}