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

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