[Templates] Use str_replace for hosts.

There is a limit to how long input data can be for the heat script hook.

Change-Id: I48286e300874d7d8311d2ef14f95b6fc87ed579c
Closes-Bug: #1772673
(cherry picked from commit 6e901b3d6b)
This commit is contained in:
Natal Ngétal 2018-11-07 11:52:36 +01:00
parent 9e2afdb747
commit bc8cb17293
2 changed files with 11 additions and 9 deletions

View File

@ -11,15 +11,16 @@ resources:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: script group: script
inputs: config:
- name: hosts str_replace:
default: params:
list_join: WRITE_HOSTS:
- ' ' list_join:
- str_split: - ' '
- '\n' - str_split:
- {get_param: hosts} - '\n'
config: {get_file: scripts/hosts-config.sh} - {get_param: hosts}
template: {get_file: scripts/hosts-config.sh}
outputs: outputs:
config_id: config_id:

View File

@ -36,6 +36,7 @@ write_entries() {
} }
hosts="WRITE_HOSTS"
if [ ! -z "$hosts" ]; then if [ ! -z "$hosts" ]; then
for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
write_entries "$tmpl" "$hosts" write_entries "$tmpl" "$hosts"