Merge "Check common.keyring is provided before check common.keyring.admin key"
diff --git a/ceph/setup/keyring.sls b/ceph/setup/keyring.sls
index 5ba3c5d..5b295ea 100644
--- a/ceph/setup/keyring.sls
+++ b/ceph/setup/keyring.sls
@@ -60,16 +60,20 @@
{%- set caps = salt['cmd.shell']('ceph auth list --format json') | load_json %}
{%- for client in caps['auth_dump'] %}
{%- if client['entity'] == "client." + keyring_client_name %}
+ {%- set update_caps = [] %}
{%- for cap_name, cap in client.caps.iteritems() %}
{%- if cap != keyring.caps[cap_name] %}
-ceph_update_caps_{{ cap_name }}_for_{{ keyring_client_name }}:
- cmd.run:
- - name: ceph -c /etc/ceph/{{ ceph_cluster }}.conf auth caps client.{{ keyring_client_name }} {{ cap_name }} '{{ cap }}'
- - require:
- - file: common_config
-
+ {%- do update_caps.append(cap_name) %}
{%- endif %}
{%- endfor %}
+
+ {%- if update_caps %}
+ceph_update_caps_{{ update_caps|join('_') }}_for_{{ keyring_client_name }}:
+ cmd.run:
+ - name: ceph -c /etc/ceph/{{ ceph_cluster }}.conf auth caps client.{{ keyring_client_name }} {%- for cap_name, cap in keyring.caps.iteritems() %} {{ cap_name }} '{{ cap }}' {%- endfor %}
+ - require:
+ - file: common_config
+ {%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}