Fix profile based grain generation

Previously it was possible to generate profiled based grains for
both cases when keystone.server is enabled and disabled.
After [0] was merged profile based grains can't be generated for
case when keystone.server is enabled. This patch fixes it.

[0] https://gerrit.mcp.mirantis.net/4525

Change-Id: Id7c4780d9aab30aec4878b707573df81a3ceef8f
diff --git a/keystone/meta/salt.yml b/keystone/meta/salt.yml
index b00f02c..7246158 100644
--- a/keystone/meta/salt.yml
+++ b/keystone/meta/salt.yml
@@ -9,36 +9,38 @@
 
 minion:
   {%- if pillar.keystone.server is defined or pillar.keystone.client is defined %}
+    {%- from "keystone/map.jinja" import server with context %}
+    {%- from "keystone/map.jinja" import client with context %}
+
   keystone:
     {%- if pillar.keystone.get('server', {'enabled': False}).enabled %}
-      {%- from "keystone/map.jinja" import server with context %}
     keystone.token: '{{ server.service_token }}'
     keystone.endpoint: 'http://{{ server.bind.address }}:{{ server.bind.private_port }}/v2.0'
     {%- else %}
-      {%- from "keystone/map.jinja" import client with context %}
       {%- if client.server.user is defined %}
     keystone.user: '{{ client.server.user }}'
     keystone.password: '{{ client.server.password }}'
     keystone.tenant: '{{ client.server.tenant }}'
     keystone.auth_url: 'http://{{ client.server.host }}:{{ client.server.public_port }}/v2.0/'
+      {%- endif %}
+    {%- endif %}
+
+    {#- Profile based metadata #}
+    {%- for profile_name, identity in client.server.iteritems() %}
+      {%- if identity.admin.get('protocol', 'http') == 'http' %}
+        {%- set protocol = 'http' %}
       {%- else %}
+        {%- set protocol = 'https' %}
+      {%- endif %}
 
-        {#- Profile based metadata #}
-        {%- for profile_name, identity in client.server.iteritems() %}
-          {%- if identity.admin.get('protocol', 'http') == 'http' %}
-            {%- set protocol = 'http' %}
-          {%- else %}
-            {%- set protocol = 'https' %}
-          {%- endif %}
+      {%- if identity.admin.get('api_version', '2') == '3' %}
+        {%- set version = "v3" %}
+      {%- else %}
+        {%- set version = "v2.0" %}
+      {%- endif %}
 
-          {%- if identity.admin.get('api_version', '2') == '3' %}
-            {%- set version = "v3" %}
-          {%- else %}
-            {%- set version = "v2.0" %}
-          {%- endif %}
-
-          {%- if identity.admin.user is defined %}
-            {%- if identity.admin.token is not defined %}
+      {%- if identity.admin.user is defined %}
+        {%- if identity.admin.token is not defined %}
 
     {{ profile_name }}:
       keystone.user: '{{ identity.admin.user }}'
@@ -47,11 +49,9 @@
       keystone.auth_url: '{{ protocol+'://'+identity.admin.host+':'+identity.admin.port|string+'/'+version }}'
       keystone.region_name: '{{ identity.admin.region_name }}'
 
-            {%- endif %}
-          {%- endif %}
-        {%- endfor %}
+        {%- endif %}
       {%- endif %}
-    {%- endif %}
+    {%- endfor %}
   {%- endif %}
 
 {#-