Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions templates/common/_base/files/nmstate-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"