Skip to content

Commit 8989e93

Browse files
committed
Fixed profile swap in 'core.extension.yml' to also update module list.
1 parent 2e9efcb commit 8989e93

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

scripts/vortex/provision.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,19 @@ provision_from_profile() {
216216

217217
[ "${has_config}" = "1" ] && opts+=(--existing-config)
218218

219-
# When falling back with config files, update the profile in
220-
# core.extension.yml to match the fallback profile to avoid
219+
# When falling back with config files, update core.extension.yml to
220+
# replace the original profile with the fallback profile to avoid
221221
# "does not match the profile stored in configuration" error.
222222
if [ "${is_fallback}" = "1" ] && [ "${has_config}" = "1" ]; then
223223
if [ -f "${config_path}/core.extension.yml" ]; then
224+
local original_profile
225+
original_profile="$(grep '^profile: ' "${config_path}/core.extension.yml" | sed 's/^profile: //')"
224226
sed -i "s/^profile: .*/profile: ${profile}/" "${config_path}/core.extension.yml"
227+
if [ -n "${original_profile}" ] && [ "${original_profile}" != "${profile}" ]; then
228+
sed -i "/^ ${original_profile}: /d" "${config_path}/core.extension.yml"
229+
sed -i "/^ ${profile}: /d" "${config_path}/core.extension.yml"
230+
sed -i "/^module:/a\\ ${profile}: 1000" "${config_path}/core.extension.yml"
231+
fi
225232
fi
226233
fi
227234

0 commit comments

Comments
 (0)