blob: cf0b5cb52f4f11449074f67306887d5bcbe92cef [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 -%}
3{%- macro credentials(parameters) -%}
4{%- set keys = ['token', 'username', 'password'] -%}
5"credentials": {
6{%- for key, value in salt['devops_utils.iter_items'](keys, parameters) %}
7 {%- if not loop.first %},{% endif %}
8 "{{ key }}": "{{ value }}"
9{%- endfor %}
10}
11{%- endmacro %}
12{
13 "services": {
Ilya Kharinfd293c42017-03-14 17:34:12 +040014 {%- for service_name, service in salt['devops_utils.iter_items'](services, config.services) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040015 {%- if not loop.first %},{% endif -%}
16 {%- if service|length() > 0 and service.enabled %}
17 "{{ service_name }}": {
18 "endpoint": "{{ service.endpoint }}"
19 {%- if service.credentials is defined and service.credentials|length() > 0 -%},
20 {{ credentials(service.credentials)|indent(width=8) }}
21 {%- endif %}
22 }
23 {%- endif %}
24 {%- endfor %}
25 }
26}