blob: 72ce97b355f14b3627a51e3f4881d0582af772a6 [file] [log] [blame]
Ilya Kharinfd293c42017-03-14 17:34:12 +04001{%- from "devops_portal/map.jinja" import config with context -%}
Ilya Kharin9954eaf2017-03-06 15:21:07 +04002{%- from "devops_portal/map.jinja" import services with context -%}
Ilya Kharine1cf8542017-03-17 18:37:09 +04003{%- from "devops_portal/map.jinja" import service_url with context -%}
Ilya Kharin9954eaf2017-03-06 15:21:07 +04004{%- macro credentials(parameters) -%}
5{%- set keys = ['token', 'username', 'password'] -%}
6"credentials": {
7{%- for key, value in salt['devops_utils.iter_items'](keys, parameters) %}
8 {%- if not loop.first %},{% endif %}
Ramon Melero8abe5a42017-10-05 17:38:53 -05009 {%- if value != None %}
10 "{{ key }}": "{{ value }}"{% else %}
11 "{{ key }}": ""{%- endif %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040012{%- endfor %}
13}
14{%- endmacro %}
15{
16 "services": {
Ilya Kharin918686b2017-03-16 20:09:13 +040017 {%- for service_name, service in salt['devops_utils.iter_items'](services, config.service) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040018 {%- if not loop.first %},{% endif -%}
Ilya Kharin3ce0cd12017-03-17 18:49:45 +040019 {%- if service.enabled|default(True) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040020 "{{ service_name }}": {
Ilya Kharine1cf8542017-03-17 18:37:09 +040021 "endpoint": "{{ service_url(service.endpoint) }}"
Ilya Kharin9954eaf2017-03-06 15:21:07 +040022 {%- if service.credentials is defined and service.credentials|length() > 0 -%},
23 {{ credentials(service.credentials)|indent(width=8) }}
24 {%- endif %}
25 }
26 {%- endif %}
27 {%- endfor %}
28 }
29}