Blame SOURCES/bz2157872-3-pgsqlms-validate-all-OCF_CHECK_LEVEL-10.patch

f18d3d
--- a/heartbeat/pgsqlms	2023-01-04 14:42:36.093258702 +0100
f18d3d
+++ b/heartbeat/pgsqlms	2023-01-04 14:40:52.403994545 +0100
f18d3d
@@ -66,6 +66,7 @@
f18d3d
 my $maxlag       = $ENV{'OCF_RESKEY_maxlag'} || $maxlag_default;
f18d3d
 my $recovery_tpl = $ENV{'OCF_RESKEY_recovery_template'}
f18d3d
     || "$pgdata/recovery.conf.pcmk";
f18d3d
+my $ocf_check_level = $ENV{'OCF_CHECK_LEVEL'} || 0;
f18d3d
 
f18d3d
 
f18d3d
 # PostgreSQL commands path
f18d3d
@@ -1304,26 +1305,28 @@
f18d3d
         return $OCF_ERR_INSTALLED;
f18d3d
     }
f18d3d
 
f18d3d
-    # check notify=true
f18d3d
-    $ans = qx{ $CRM_RESOURCE --resource "$OCF_RESOURCE_INSTANCE" \\
f18d3d
-                 --meta --get-parameter notify 2>/dev/null };
f18d3d
-    chomp $ans;
f18d3d
-    unless ( lc($ans) =~ /^true$|^on$|^yes$|^y$|^1$/ ) {
f18d3d
-        ocf_exit_reason(
f18d3d
-            'You must set meta parameter notify=true for your master resource'
f18d3d
-        );
f18d3d
-        return $OCF_ERR_INSTALLED;
f18d3d
-    }
f18d3d
+    if ( $ocf_check_level == 10 ) {
f18d3d
+        # check notify=true
f18d3d
+        $ans = qx{ $CRM_RESOURCE --resource "$OCF_RESOURCE_INSTANCE" \\
f18d3d
+                     --meta --get-parameter notify 2>/dev/null };
f18d3d
+        chomp $ans;
f18d3d
+        unless ( lc($ans) =~ /^true$|^on$|^yes$|^y$|^1$/ ) {
f18d3d
+            ocf_exit_reason(
f18d3d
+                'You must set meta parameter notify=true for your "master" resource'
f18d3d
+            );
f18d3d
+            return $OCF_ERR_INSTALLED;
f18d3d
+        }
f18d3d
 
f18d3d
-    # check master-max=1
f18d3d
-    unless (
f18d3d
-        defined $ENV{'OCF_RESKEY_CRM_meta_master_max'}
f18d3d
-            and $ENV{'OCF_RESKEY_CRM_meta_master_max'} eq '1'
f18d3d
-    ) {
f18d3d
-        ocf_exit_reason(
f18d3d
-            'You must set meta parameter master-max=1 for your master resource'
f18d3d
-        );
f18d3d
-        return $OCF_ERR_INSTALLED;
f18d3d
+        # check master-max=1
f18d3d
+        unless (
f18d3d
+            defined $ENV{'OCF_RESKEY_CRM_meta_master_max'}
f18d3d
+                and $ENV{'OCF_RESKEY_CRM_meta_master_max'} eq '1'
f18d3d
+        ) {
f18d3d
+            ocf_exit_reason(
f18d3d
+                'You must set meta parameter master-max=1 for your "master" resource'
f18d3d
+            );
f18d3d
+            return $OCF_ERR_INSTALLED;
f18d3d
+        }
f18d3d
     }
f18d3d
 
f18d3d
     if ( $PGVERNUM >= $PGVER_12 ) {
f18d3d
@@ -2242,6 +2245,9 @@
f18d3d
 # Set current node name.
f18d3d
 $nodename = ocf_local_nodename();
f18d3d
 
f18d3d
+if ( $__OCF_ACTION ne 'validate-all' ) {
f18d3d
+    $ocf_check_level = 10;
f18d3d
+}
f18d3d
 $exit_code = pgsql_validate_all();
f18d3d
 
f18d3d
 exit $exit_code if $exit_code != $OCF_SUCCESS or $__OCF_ACTION eq 'validate-all';