INNER CODE UNIT · Go

compareHashAndRunCommand

CrunchyData/crunchy-containers · cmd/pgbackrest/main.go:313

func compareHashAndRunCommand(kubeapi *KubeAPI, cfg config, cmd []string) (string, string, error) {

	// the base script used in both the local and exec commands created below
	baseScript := `
shopt -s globstar
files=(/etc/pgbackrest/conf.d/**)
for i in "${!files[@]}"; do
	[[ -f "${files[$i]}" ]] || unset -v "files[$i]"
done`

	// the script run locally to get the local hash
	localScript := baseScript + `
sha1sum "${files[@]}" | sha1sum
`

	// the script to run remotely via exec
	execScript := baseScript + `
declare -r hash="$1"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…