Rename control into config

Change-Id: I13ef171b9294d607e590db6b8d96019477e72c71
diff --git a/devops_portal/control.sls b/devops_portal/config.sls
similarity index 67%
rename from devops_portal/control.sls
rename to devops_portal/config.sls
index 026b899..d8431c8 100644
--- a/devops_portal/control.sls
+++ b/devops_portal/config.sls
@@ -1,11 +1,11 @@
-{%- from "devops_portal/map.jinja" import control with context %}
-{%- if control.enabled %}
+{%- from "devops_portal/map.jinja" import config with context %}
+{%- if config.enabled %}
 
 devops_portal_dirs:
   file.directory:
     - names:
-      - {{ control.base_dir }}/nginx
-      - {{ control.base_dir }}/config
+      - {{ config.base_dir }}/nginx
+      - {{ config.base_dir }}/config
     - user: root
     - group: root
     - mode: 0755
@@ -13,7 +13,7 @@
 
 devops_portal_nginx_conf:
   file.managed:
-    - name: {{ control.base_dir }}/nginx/nginx.conf
+    - name: {{ config.base_dir }}/nginx/nginx.conf
     - source: salt://devops_portal/files/nginx.conf
     - template: jinja
     - user: root
@@ -24,7 +24,7 @@
 
 devops_portal_config:
   file.managed:
-    - name: {{ control.base_dir }}/config/config.json
+    - name: {{ config.base_dir }}/config/config.json
     - source: salt://devops_portal/files/config.json
     - template: jinja
     - user: root
diff --git a/devops_portal/files/config.json b/devops_portal/files/config.json
index bb07fae..cf0b5cb 100644
--- a/devops_portal/files/config.json
+++ b/devops_portal/files/config.json
@@ -1,4 +1,4 @@
-{%- from "devops_portal/map.jinja" import control with context -%}
+{%- from "devops_portal/map.jinja" import config with context -%}
 {%- from "devops_portal/map.jinja" import services with context -%}
 {%- macro credentials(parameters) -%}
 {%- set keys = ['token', 'username', 'password'] -%}
@@ -11,7 +11,7 @@
 {%- endmacro %}
 {
   "services": {
-  {%- for service_name, service in salt['devops_utils.iter_items'](services, control.services) %}
+  {%- for service_name, service in salt['devops_utils.iter_items'](services, config.services) %}
     {%- if not loop.first %},{% endif -%}
     {%- if service|length() > 0 and service.enabled %}
     "{{ service_name }}": {
diff --git a/devops_portal/files/kubernetes/devops_portal-cm.yaml b/devops_portal/files/kubernetes/devops_portal-cm.yaml
index 589b434..fcfaa48 100644
--- a/devops_portal/files/kubernetes/devops_portal-cm.yaml
+++ b/devops_portal/files/kubernetes/devops_portal-cm.yaml
@@ -1,3 +1,4 @@
+{%- from "devops_portal/map.jinja" import config with context %}
 {%- macro include_by_filename(filename) -%}
   {%- include filename -%}
 {%- endmacro -%}
@@ -7,6 +8,6 @@
   name: devops-portal
 data:
   config.json: |
-{{ include_by_filename('/srv/oss/devops_portal/config/config.json')|indent(width=4, indentfirst=True) }}
+{{ include_by_filename(config.base_dir + '/config/config.json')|indent(width=4, indentfirst=True) }}
   nginx.conf: |
-{{ include_by_filename('/srv/oss/devops_portal/nginx/nginx.conf')|indent(width=4, indentfirst=True) }}
+{{ include_by_filename(config.base_dir + '/nginx/nginx.conf')|indent(width=4, indentfirst=True) }}
diff --git a/devops_portal/files/kubernetes/devops_portal-deploy.yaml b/devops_portal/files/kubernetes/devops_portal-deploy.yaml
index c6c1c1e..f5d13fe 100644
--- a/devops_portal/files/kubernetes/devops_portal-deploy.yaml
+++ b/devops_portal/files/kubernetes/devops_portal-deploy.yaml
@@ -1,5 +1,5 @@
-{%- from "devops_portal/map.jinja" import control with context %}
-{%- set container = control.container %}
+{%- from "devops_portal/map.jinja" import config with context %}
+{%- set container = config.container %}
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
@@ -20,7 +20,7 @@
             - /etc/nginx/config/nginx.conf
           env:
             - name: CONFIGMAP_HASH
-              value: {{ salt['hashutil.digest_file']('/srv/oss/devops_portal/kubernetes/devops_portal-cm.yaml') }}
+              value: {{ salt['hashutil.digest_file'](config.base_dir + '/kubernetes/devops_portal-cm.yaml') }}
           volumeMounts:
             - name: nginx-conf
               mountPath: /etc/nginx/config
diff --git a/devops_portal/files/kubernetes/devops_portal-svc.yaml b/devops_portal/files/kubernetes/devops_portal-svc.yaml
index cde5657..ea102f8 100644
--- a/devops_portal/files/kubernetes/devops_portal-svc.yaml
+++ b/devops_portal/files/kubernetes/devops_portal-svc.yaml
@@ -1,5 +1,5 @@
-{%- from "devops_portal/map.jinja" import control with context %}
-{%- set container = control.container %}
+{%- from "devops_portal/map.jinja" import config with context %}
+{%- set container = config.container %}
 apiVersion: v1
 kind: Service
 metadata:
diff --git a/devops_portal/files/nginx.conf b/devops_portal/files/nginx.conf
index bb7878a..ca27f0d 100644
--- a/devops_portal/files/nginx.conf
+++ b/devops_portal/files/nginx.conf
@@ -1,4 +1,4 @@
-{%- from "devops_portal/map.jinja" import control with context -%}
+{%- from "devops_portal/map.jinja" import config with context -%}
 {%- from "devops_portal/map.jinja" import services with context -%}
 daemon off;
 
@@ -42,8 +42,8 @@
         }
 
 {%- for service_name in services %}
-{%- if control.services[service_name] is defined %}
-{%- set service = control.services[service_name] %}
+{%- if config.services[service_name] is defined %}
+{%- set service = config.services[service_name] %}
 {%- if service.enabled|default(False) and service.configure_proxy|default(False) %}
 
         location /api/{{ service_name }} {
diff --git a/devops_portal/init.sls b/devops_portal/init.sls
index 00649c7..f89686e 100644
--- a/devops_portal/init.sls
+++ b/devops_portal/init.sls
@@ -1,7 +1,9 @@
 {%- if pillar.devops_portal is defined %}
 include:
-{%- if pillar.devops_portal.control is defined %}
-  - devops_portal.control
+{%- if pillar.devops_portal.config is defined %}
+  - devops_portal.config
+{%- if pillar.devops_portal.setup is defined %}
   - devops_portal.setup
 {%- endif %}
 {%- endif %}
+{%- endif %}
diff --git a/devops_portal/map.jinja b/devops_portal/map.jinja
index 966037c..fd15d42 100644
--- a/devops_portal/map.jinja
+++ b/devops_portal/map.jinja
@@ -1,5 +1,5 @@
-{% set control = salt['pillar.get']('devops_portal:setup') %}
-{% set control = salt['pillar.get']('devops_portal:control', default={
+{% set setup = salt['pillar.get']('devops_portal:setup') %}
+{% set config = salt['pillar.get']('devops_portal:config', default={
   "base_dir": "/srv/volumes/devops_portal",
 }, merge=True) %}
 
diff --git a/devops_portal/setup/kubernetes.sls b/devops_portal/setup/kubernetes.sls
index 375d183..ecafbe1 100644
--- a/devops_portal/setup/kubernetes.sls
+++ b/devops_portal/setup/kubernetes.sls
@@ -1,10 +1,10 @@
-{%- from "devops_portal/map.jinja" import control with context %}
-{%- if control.setup.engine == "kubernetes" %}
-{%- set namespace = control.setup.kubernetes.namespace|default("oss") %}
+{%- from "devops_portal/map.jinja" import config with context %}
+{%- if config.setup.engine == "kubernetes" %}
+{%- set namespace = config.setup.kubernetes.namespace|default("oss") %}
 
 devops_portal_kubernetes_dir:
   file.directory:
-    - name: /srv/oss/devops_portal/kubernetes
+    - name: {{ config.base_dir }}/kubernetes
     - user: root
     - group: root
     - mode: 0755
@@ -12,7 +12,7 @@
 
 devops_portal_k8s_svc:
   file.managed:
-    - name: /srv/oss/devops_portal/kubernetes/devops_portal-svc.yaml
+    - name: {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml
     - source: salt://devops_portal/files/kubernetes/devops_portal-svc.yaml
     - template: jinja
     - require:
@@ -20,7 +20,7 @@
 
 devops_portal_k8s_cm:
   file.managed:
-    - name: /srv/oss/devops_portal/kubernetes/devops_portal-cm.yaml
+    - name: {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml
     - source: salt://devops_portal/files/kubernetes/devops_portal-cm.yaml
     - template: jinja
     - require:
@@ -30,7 +30,7 @@
 
 devops_portal_k8s_deploy:
   file.managed:
-    - name: /srv/oss/devops_portal/kubernetes/devops_portal-deploy.yaml
+    - name: {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml
     - source: salt://devops_portal/files/kubernetes/devops_portal-deploy.yaml
     - template: jinja
     - require:
@@ -45,9 +45,9 @@
 apply_devops_portal:
   cmd.run:
     - name: hyperkube kubectl apply
-            --filename /srv/oss/devops_portal/kubernetes/devops_portal-svc.yaml
-            --filename /srv/oss/devops_portal/kubernetes/devops_portal-cm.yaml
-            --filename /srv/oss/devops_portal/kubernetes/devops_portal-deploy.yaml
+            --filename {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml
+            --filename {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml
+            --filename {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml
             --namespace={{ namespace }}
             --record
     - require: