Simplify conditions in heat service templates

This is part of a series of patches to reduce the
template complexity.

Change-Id: I685ec7d7c583c9f8d9f04b0f1027136ed042487c
This commit is contained in:
ramishra 2021-03-29 09:11:45 +05:30
parent c9991c2e31
commit 4ee0f18947
4 changed files with 28 additions and 47 deletions

@ -59,9 +59,8 @@ parameters:
type: string type: string
conditions: conditions:
heat_workers_set:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]} not: {equals : [{get_param: HeatWorkers}, 0]}
heat_workers_zero: {equals : [{get_param: HeatWorkers}, 0]}
resources: resources:
@ -142,10 +141,8 @@ outputs:
"%{hiera('fqdn_$NETWORK')}" "%{hiera('fqdn_$NETWORK')}"
params: params:
$NETWORK: {get_param: [ServiceNetMap, HeatApiCfnNetwork]} $NETWORK: {get_param: [ServiceNetMap, HeatApiCfnNetwork]}
-
if: if:
- heat_workers_zero - heat_workers_set
- {}
- heat::wsgi::apache_api_cfn::workers: {get_param: HeatWorkers} - heat::wsgi::apache_api_cfn::workers: {get_param: HeatWorkers}
service_config_settings: service_config_settings:
rsyslog: rsyslog:
@ -203,13 +200,9 @@ outputs:
- /var/lib/kolla/config_files/heat_api_cfn.json:/var/lib/kolla/config_files/config.json:ro - /var/lib/kolla/config_files/heat_api_cfn.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat_api_cfn:/var/lib/kolla/config_files/src:ro - /var/lib/config-data/puppet-generated/heat_api_cfn:/var/lib/kolla/config_files/src:ro
- if: - if:
- internal_tls_enabled - {get_param: EnableInternalTLS}
- - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro - - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
- [] - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- if:
- internal_tls_enabled
- - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- []
environment: environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]} host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]}

@ -77,9 +77,8 @@ parameters:
hidden: true hidden: true
conditions: conditions:
heat_workers_set:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]} not: {equals : [{get_param: HeatWorkers}, 0]}
heat_workers_zero: {equals : [{get_param: HeatWorkers}, 0]}
resources: resources:
@ -172,10 +171,8 @@ outputs:
"%{hiera('fqdn_$NETWORK')}" "%{hiera('fqdn_$NETWORK')}"
params: params:
$NETWORK: {get_param: [ServiceNetMap, HeatApiNetwork]} $NETWORK: {get_param: [ServiceNetMap, HeatApiNetwork]}
-
if: if:
- heat_workers_zero - heat_workers_set
- {}
- heat::wsgi::apache_api::workers: {get_param: HeatWorkers} - heat::wsgi::apache_api::workers: {get_param: HeatWorkers}
service_config_settings: service_config_settings:
rsyslog: rsyslog:
@ -241,17 +238,12 @@ outputs:
- {get_attr: [ContainersCommon, volumes]} - {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatApiLogging, volumes]} - {get_attr: [HeatApiLogging, volumes]}
- {get_param: HeatApiOptVolumes} - {get_param: HeatApiOptVolumes}
- - - /var/lib/kolla/config_files/heat_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/kolla/config_files/heat_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat_api:/var/lib/kolla/config_files/src:ro - /var/lib/config-data/puppet-generated/heat_api:/var/lib/kolla/config_files/src:ro
- if: - if:
- internal_tls_enabled - {get_param: EnableInternalTLS}
- - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro - - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
- [] - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- if:
- internal_tls_enabled
- - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- []
environment: environment:
map_merge: map_merge:
- {get_param: HeatApiOptEnvVars} - {get_param: HeatApiOptEnvVars}

@ -141,7 +141,8 @@ conditions:
and: and:
- {get_param: EnableCache} - {get_param: EnableCache}
- {get_param: MemcachedTLS} - {get_param: MemcachedTLS}
cors_allowed_origin_unset: {equals : [{get_param: HeatCorsAllowedOrigin}, '']} cors_allowed_origin_set:
not: {equals : [{get_param: HeatCorsAllowedOrigin}, '']}
outputs: outputs:
role_data: role_data:
@ -152,8 +153,7 @@ outputs:
map_merge: map_merge:
- -
if: if:
- cors_allowed_origin_unset - cors_allowed_origin_set
- {}
- heat::cors::allowed_origin: {get_param: HeatCorsAllowedOrigin} - heat::cors::allowed_origin: {get_param: HeatCorsAllowedOrigin}
- heat::notification_driver: {get_param: NotificationDriver} - heat::notification_driver: {get_param: NotificationDriver}
heat::logging::debug: heat::logging::debug:

@ -115,8 +115,8 @@ parameters:
description: Client retries for transient errors. description: Client retries for transient errors.
conditions: conditions:
heat_workers_unset: {equals : [{get_param: HeatWorkers}, 0]} heat_workers_set:
enable_sqlalchemy_collectd: {equals : [{get_param: EnableSQLAlchemyCollectd}, true]} not: {equals : [{get_param: HeatWorkers}, 0]}
resources: resources:
@ -176,15 +176,13 @@ outputs:
path: /heat path: /heat
query: query:
if: if:
- enable_sqlalchemy_collectd - {get_param: EnableSQLAlchemyCollectd}
- - read_default_file: /etc/my.cnf.d/tripleo.cnf
read_default_file: /etc/my.cnf.d/tripleo.cnf
read_default_group: tripleo read_default_group: tripleo
plugin: collectd plugin: collectd
collectd_program_name: heat collectd_program_name: heat
collectd_host: localhost collectd_host: localhost
- - read_default_file: /etc/my.cnf.d/tripleo.cnf
read_default_file: /etc/my.cnf.d/tripleo.cnf
read_default_group: tripleo read_default_group: tripleo
heat::keystone_ec2_uri: heat::keystone_ec2_uri:
@ -195,10 +193,8 @@ outputs:
heat::keystone::domain::domain_password: {get_param: HeatStackDomainAdminPassword} heat::keystone::domain::domain_password: {get_param: HeatStackDomainAdminPassword}
heat::engine::auth_encryption_key: {get_param: HeatAuthEncryptionKey} heat::engine::auth_encryption_key: {get_param: HeatAuthEncryptionKey}
heat::engine::plugin_dirs: {get_param: HeatEnginePluginDirs} heat::engine::plugin_dirs: {get_param: HeatEnginePluginDirs}
-
if: if:
- heat_workers_unset - heat_workers_set
- {}
- heat::engine::num_engine_workers: {get_param: HeatWorkers} - heat::engine::num_engine_workers: {get_param: HeatWorkers}
service_config_settings: service_config_settings:
rsyslog: rsyslog: