enable ceph key from grains

Change-Id: I4ff3ab3608503feb67375adbae7ba063b4a59b4f
diff --git a/nova/compute.sls b/nova/compute.sls
index 641305e..af88b85 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -198,6 +198,19 @@
   - require:
     - file: /etc/secret.xml
 
+{%- set client_cinder_key = salt['grains.get']("ceph:ceph_keyring:"+compute.ceph.client_cinder_key+":key", '') %}
+
+{%- if client_cinder_key != '' %}
+
+ceph_virsh_secret_set_value:
+  cmd.run:
+  - name: "virsh secret-set-value --secret {{ compute.ceph.secret_uuid }} --base64 {{ client_cinder_key }} "
+  - unless: "virsh secret-get-value {{ compute.ceph.secret_uuid }} | grep {{ client_cinder_key }}"
+  - require:
+    - cmd: ceph_virsh_secret_define
+
+{% else %}
+
 ceph_virsh_secret_set_value:
   cmd.run:
   - name: "virsh secret-set-value --secret {{ compute.ceph.secret_uuid }} --base64 {{ compute.ceph.client_cinder_key }} "
@@ -207,6 +220,8 @@
 
 {% endif %}
 
+{% endif %}
+
 {%- if compute.libvirt_bin is defined %}
 {{ compute.libvirt_bin }}:
   file.managed: