From 19a730a1c46c029b5d5720222042213d7c9b818c Mon Sep 17 00:00:00 2001 From: Mark Burnett Date: Fri, 17 Nov 2017 16:37:47 -0600 Subject: [PATCH] Fix: Update use of cmp to expect correct exit code This update to the usage of `cmp` in the anchor scripts will cause the scripts to overwrite existing manifests whenever differences are detected. This should only occur during genesis, but may occur if a file is accidentily modified on a node and the anchor then checks the file for changes. Change-Id: Ic594fef2c5a5c30a5be3ccc7ab51efcd29c8cdcc --- charts/apiserver/templates/bin/_anchor.tpl | 2 +- charts/controller_manager/templates/bin/_anchor.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/apiserver/templates/bin/_anchor.tpl b/charts/apiserver/templates/bin/_anchor.tpl index 8f165e2a..6af65c05 100644 --- a/charts/apiserver/templates/bin/_anchor.tpl +++ b/charts/apiserver/templates/bin/_anchor.tpl @@ -18,7 +18,7 @@ set -x compare_copy_files() { {{range .Values.anchor.files_to_copy}} - if [ ! -e /host{{ .dest }} ] || cmp -s {{ .source }} /host{{ .dest }}; then + if [ ! -e /host{{ .dest }} ] || ! cmp -s {{ .source }} /host{{ .dest }}; then mkdir -p $(dirname /host{{ .dest }}) cp {{ .source }} /host{{ .dest }} fi diff --git a/charts/controller_manager/templates/bin/_anchor.tpl b/charts/controller_manager/templates/bin/_anchor.tpl index 8f165e2a..6af65c05 100644 --- a/charts/controller_manager/templates/bin/_anchor.tpl +++ b/charts/controller_manager/templates/bin/_anchor.tpl @@ -18,7 +18,7 @@ set -x compare_copy_files() { {{range .Values.anchor.files_to_copy}} - if [ ! -e /host{{ .dest }} ] || cmp -s {{ .source }} /host{{ .dest }}; then + if [ ! -e /host{{ .dest }} ] || ! cmp -s {{ .source }} /host{{ .dest }}; then mkdir -p $(dirname /host{{ .dest }}) cp {{ .source }} /host{{ .dest }} fi