Do not include manila ceph key resource twice
authorJan Provaznik <jprovazn@redhat.com>
Thu, 10 Aug 2017 15:38:57 +0000 (17:38 +0200)
committerJan Provaznik <jprovazn@redhat.com>
Thu, 10 Aug 2017 15:38:57 +0000 (17:38 +0200)
When mds creates manila key [1], then manila manifest needs to check
first if this resource already exists otherwise puppet fails.

[1] I6308a317ffe0af244396aba5197c85e273e69f68

Change-Id: I3f18bbe476c4f43fa4e162cc66c5df443122cd0c

manifests/profile/pacemaker/manila.pp

index c22a033..25d389a 100644 (file)
@@ -134,17 +134,19 @@ class tripleo::profile::pacemaker::manila (
         cephfs_enable_snapshots      => hiera('manila::backend::cephfsnative::cephfs_enable_snapshots'),
       }
 
-      ceph::key { "client.${cephfs_auth_id}" :
-        secret       => hiera('manila::backend::cephfsnative::ceph_client_key'),
-        keyring_path => $keyring_path,
-        # inject the new key into ceph cluster only if ceph is deployed by
-        # tripleo (if external ceph is used it should be added manually)
-        inject       => $ceph_mds_enabled,
-        user         => 'manila',
-        cap_mds      => 'allow *',
-        cap_mon      => 'allow r, allow command \"auth del\", allow command \"auth caps\", \
+      if !defined(Resource['ceph::key', "client.${cephfs_auth_id}"]) {
+        ceph::key { "client.${cephfs_auth_id}" :
+          secret       => hiera('manila::backend::cephfsnative::ceph_client_key'),
+          keyring_path => $keyring_path,
+          # inject the new key into ceph cluster only if ceph is deployed by
+          # tripleo (if external ceph is used it should be added manually)
+          inject       => $ceph_mds_enabled,
+          user         => 'manila',
+          cap_mds      => 'allow *',
+          cap_mon      => 'allow r, allow command \"auth del\", allow command \"auth caps\", \
 allow command \"auth get\", allow command \"auth get-or-create\"',
-        cap_osd      => 'allow rw'
+          cap_osd      => 'allow rw'
+        }
       }
 
       ceph_config {