Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config_migrate): always remove domain old key & replace old value by new value #5032

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

scruel
Copy link
Contributor

@scruel scruel commented Feb 28, 2024

This fixed the following issues for _migratedomainconf function:

  • it won't be able to remove empty old keys
  • it will set the old value to new key, even the value of new key already set in the config file.

For example, if we have the following config file:

SAVED_TEST=''
SAVED_Test=''
SAVED_Test1=''
SAVED_TEST1=''
SAVED_Test2=''
SAVED_Test3='old'
SAVED_TEST4='new'
SAVED_Test5=''
SAVED_TEST5='new'
SAVED_Test6='old'
SAVED_TEST6=''
SAVED_Test7='old'
SAVED_TEST7='new'
SAVED_Test8='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'
SAVED_TEST9='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'
SAVED_Test10=''

And code:

_migratedeployconf Test TEST
_migratedeployconf Test1 TEST1
_migratedeployconf Test2 TEST2
_migratedeployconf Test3 TEST3
_migratedeployconf Test4 TEST4
_migratedeployconf Test5 TEST5
_migratedeployconf Test6 TEST6
_migratedeployconf Test7 TEST7
_migratedeployconf Test8 TEST8 'base64'
_migratedeployconf Test9 TEST9 'base64'
_migratedeployconf Test10 TEST10 'base64'

Without this PR patch, the result is messy and not right.
Config file after executed as the following:

SAVED_TEST=''
SAVED_Test=''
SAVED_Test1=''
SAVED_TEST1=''
SAVED_Test2=''
SAVED_TEST4='new'
SAVED_Test5=''
SAVED_TEST5='new'
SAVED_TEST6='old'
SAVED_TEST7='old'
SAVED_TEST9='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'
SAVED_Test10=''
SAVED_TEST3='old'
SAVED_TEST8='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'

With this PR patch, the result is neat and correct:

SAVED_TEST=''
SAVED_TEST1=''
SAVED_TEST4='new'
SAVED_TEST5='new'
SAVED_TEST6='old'
SAVED_TEST7='new'
SAVED_TEST9='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'
SAVED_TEST3='old'
SAVED_TEST8='__ACME_BASE64__START_b2xk__ACME_BASE64__END_'

@Neilpang Neilpang merged commit 2d4b900 into acmesh-official:dev Mar 18, 2024
33 checks passed
@scruel scruel deleted the patch-3 branch March 19, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants