add remove_trailing_whitespace()

This commit is contained in:
Dmitry Belyaev 2023-05-17 09:14:40 +03:00
parent de0fa9eb69
commit 3c56f77c2b

View File

@ -9,14 +9,21 @@ gen_files() {
}
update_files_from() {
SRC=$1 yq -i '.autoinstall.user-data.write_files |= load(strenv(SRC)).write_files' nocloud/user-data
SRC="$2" yq -i '.autoinstall.user-data.write_files |= load(strenv(SRC)).write_files' "$1"
}
remove_trailing_whitespace() {
sed -i 's/[ \t]*$//' "$1"
}
pushd config >/dev/null 2>&1
TARGET_YML="nocloud/user-data"
TMP_YML=$(temp_yml)
gen_files "$TMP_YML"
update_files_from "$TMP_YML"
remove_trailing_whitespace "$TARGET_YML"
update_files_from "$TARGET_YML" "$TMP_YML"
rm -f "$TMP_YML"
popd >/dev/null 2>&1