diff --git a/templates/common/_base/files/nmstate-configuration.yaml b/templates/common/_base/files/nmstate-configuration.yaml index 42518fe6bb..93838a3af1 100644 --- a/templates/common/_base/files/nmstate-configuration.yaml +++ b/templates/common/_base/files/nmstate-configuration.yaml @@ -11,11 +11,6 @@ contents: rm -rf /etc/cno/mtu-migration fi - if [ -e /etc/nmstate/openshift/applied ]; then - echo "Configuration already applied, exiting" - exit 0 - fi - src_path="/etc/nmstate/openshift" dst_path="/etc/nmstate" hostname=$(hostname -s) @@ -30,11 +25,15 @@ contents: echo "No configuration found at $src_path/$host_file or $src_path/$cluster_file" exit 0 fi - - if [ -e "$dst_path/$config_file" ]; then - echo "ERROR: File $dst_path/$config_file exists. Refusing to overwrite." - exit 1 + + if [ -e "$src_path/applied" ]; then + sha_applied=$(sha256sum "$src_path/applied" | awk '{print $1}') + sha_config=$(sha256sum "$src_path/$config_file" | awk '{print $1}') + if ["$sha_applied"=="$sha_config"]; then + echo "Configuration already applied, exiting" + exit 0 + fi fi cp "$src_path/$config_file" /etc/nmstate - touch /etc/nmstate/openshift/applied + cp "$src_path/$config_file" "$src_path/applied"