Loading

PCE 3.2.5 check-nfs-consistency.sh script fails

Publish Date: May 29, 2026
Description

From PCE 3.2.5, the check-nfs-consistency.sh script fails with the following error. The error is observed as the script tries to retrieve the DATABASE_PASSWORD from the incorrect location.

ip-10-1-0-12:.../planet/share/hotfix2$ ./check-nfs-consistency.sh

analyze_fs_consistency: cleaning up

command terminated with exit code 1

Password for user c3d0a7620b00b4f1:

psql: connection to server at "design-center-vcs-db.default.svc" (100.100.95.12), port 5432 failed: FATAL:  password authentication failed for user "c3d0a7620b00b4f1"

connection to server at "design-center-vcs-db.default.svc" (100.100.95.12), port 5432 failed: FATAL:  no pg_hba.conf entry for host "100.96.3.24", user "c3d0a7620b00b4f1", database "design-center-vcs-db", SSL off

command terminated with exit code 2

analyze_fs_consistency: Analyzing  for FS consistency

analyze_fs_consistency: Building path list in projectPaths.txt

command terminated with exit code 1

Password for user c3d0a7620b00b4f1:

psql: connection to server at "design-center-vcs-db.default.svc" (100.100.95.12), port 5432 failed: FATAL:  password authentication failed for user "c3d0a7620b00b4f1"

connection to server at "design-center-vcs-db.default.svc" (100.100.95.12), port 5432 failed: FATAL:  no pg_hba.conf entry for host "100.96.1.20", user "c3d0a7620b00b4f1", database "design-center-vcs-db", SSL off

command terminated with exit code 2

analyze_fs_consistency: Moving projectPaths.txt to project-service pod

tar: /var/lib/anypoint-vcs: Cannot open: No such file or directory

tar: Error is not recoverable: exiting now

command terminated with exit code 2

analyze_fs_consistency: Checking consistency

cat: /var/lib/anypoint-vcs/projectPaths.txt: No such file or directory

analyze_fs_consistency: Analyzing results

analyze_fs_consistency: 0 inconsistencies found

analyze_fs_consistency: cleaning projectPaths.txt

 

Resolution

The fix for this is to replace the following script with the attached script. 

 

  1. Locate the script pce-tool-kit.sh on the node you are trying to run the check-nfs-consistency.sh

  2. The check-nfs-consistency.sh script references the function in pce-tool-kit.sh

  3. Replace the contents of the script with the following:

    #!/usr/bin/env bash

    function get_master_stolon_keeper {
    kubectl get pods -l component=stolon-keeper --no-headers -l release=stolon,component=stolon-keeper -o custom-columns=NAME:.metadata.name|xargs -I {} kubectl -n default exec {} -c keeper -- bash -c 'ls /stolon-data/postgres/recovery.conf > /dev/null 2>&1 && echo Standby {} || echo Master: {}' |grep Master| awk '{ print $2 }'
    }

    function get_project_service_pod {
        kubectl -n design-center get pods -l app=projects-service --no-headers -o custom-columns=NAME:.metadata.name|head -n1
    }

    function get_env_var {
          if [ "$*" == "" ]; then
              echo "Usage: ${FUNCNAME[0]} namespace podName container varName";
              return;
          fi;
            kubectl -n "$1" exec "$2" -c "$3" -i -- printenv "$4"
    }

    function get_vcs_database_password {
        kubectl get secret projects-service-env-secret -n design-center -o jsonpath='{.data.app-secret\.env}' | base64 -d | grep "DATABASE_PASSWORD" | awk -F"'" '{print $2}'
    }

    function get_vcs_db_hostname {
        get_env_var design-center "$(get_project_service_pod)" application DATABASE_HOSTNAME
    }

    function get_vcs_db_user {
        get_env_var design-center "$(get_project_service_pod)" application DATABASE_USERNAME
    }

    function get_vcs_db_name {
        get_env_var design-center "$(get_project_service_pod)" application DATABASE_NAME
    }

    function execute_vcs_query {
        if [ "$*" == "" ]; then
            echo "Usage: ${FUNCNAME[0]} sqlQuery";
            return;
        fi;
        kubectl exec "$(get_master_stolon_keeper)" -c keeper -t  -- bash -c "echo \"$*\" | PGPASSWORD=$(get_vcs_database_password) psql -U $(get_vcs_db_user) -h $(get_vcs_db_hostname) $(get_vcs_db_name) -t -A"
    }

    function count_projects {
      execute_vcs_query "SELECT COUNT(*) FROM project p WHERE p.deleted=false"
    }

    function analyze_fs_consistency {
      logTag="${FUNCNAME[0]}:"
      echo "$logTag cleaning up"
      rm -f missingPath.txt projectPaths.txt
      echo "$logTag Analyzing $(count_projects) for FS consistency"
      echo "$logTag Building path list in projectPaths.txt"
      execute_vcs_query "SELECT p.external_uri FROM project p WHERE p.deleted=false" > projectPaths.txt
      echo "$logTag Moving projectPaths.txt to project-service pod"
      kubectl cp ./projectPaths.txt design-center/"$(get_project_service_pod)":/var/lib/anypoint-vcs-bare/. -c application
      kubectl cp ./projectPaths.txt design-center/"$(get_project_service_pod)":/var/lib/anypoint-vcs-wc/. -c application
      echo "$logTag Checking consistency"
      kubectl -n design-center exec "$(get_project_service_pod)" -c application -i -- bash -c "echo && cat /var/lib/anypoint-vcs-bare/projectPaths.txt | (while read dir; do ( [ ! -d \"\$dir\" ] && echo \"\$dir\" || true) done)" | grep -v -e '^$' >> missingPath.txt 2> /dev/null
      kubectl -n design-center exec "$(get_project_service_pod)" -c application -i -- bash -c "echo && cat /var/lib/anypoint-vcs-wc/projectPaths.txt | (while read dir; do ( [ ! -d \"\$dir\" ] && echo \"\$dir\" || true) done)" | grep -v -e '^$' >> missingPath.txt 2> /dev/null
      echo "$logTag Analyzing results"
      inconsistencies="$(wc -l < missingPath.txt)"
      if [ "$inconsistencies" -gt 0 ];
      then
        echo "$logTag found $inconsistencies inconsistencies"
        echo "Missing paths:"
        cat missingPath.txt
        echo "Please fix inconsistencies and try again"
        return 127
      else echo "$logTag $inconsistencies inconsistencies found"
      fi
      echo "$logTag cleaning projectPaths.txt"
      rm projectPaths.txt
    }

Issues Fixed:

 

  1. Retrieve DATABASE_PASSWORD from kubernetes secret instead of environment variables in the design-center/project-service pods.

  2. Update the anypoint-vcs project path configured on the NFS mounted in the service pods.

    1. From /var/lib/anypoint-vcs to /var/lib/anypoint-vcs-bare and /var/lib/anypoint-vcs-wc

Knowledge Article Number

005385646

 
Loading
Salesforce Help | Article