blob: 3cf0dca4ae4851726990d47ca4b0f8a8338532a3 [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 %}
9 "{{ key }}": "{{ value }}"
10{%- endfor %}
11}
12{%- endmacro %}
13{
14 "services": {
Ilya Kharin918686b2017-03-16 20:09:13 +040015 {%- for service_name, service in salt['devops_utils.iter_items'](services, config.service) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040016 {%- if not loop.first %},{% endif -%}
17 {%- if service|length() > 0 and service.enabled %}
18 "{{ service_name }}": {
Ilya Kharine1cf8542017-03-17 18:37:09 +040019 "endpoint": "{{ service_url(service.endpoint) }}"
Ilya Kharin9954eaf2017-03-06 15:21:07 +040020 {%- if service.credentials is defined and service.credentials|length() > 0 -%},
21 {{ credentials(service.credentials)|indent(width=8) }}
22 {%- endif %}
23 }
24 {%- endif %}
25 {%- endfor %}
26 }
27}