-
Notifications
You must be signed in to change notification settings - Fork 143
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: handle no topgrade.toml but files in topgrade.d #460
Conversation
Good catch! I can reproduce the issue that this PR tries to fix with the latest git version of $ pwd
/home/steve/.config/topgrade.d
$ ls
Permissions Links Size User Group Date Modified Name
.rw-r--r--@ 1 191 steve steve 2 Jun 14:59 topgrade.toml
$ topgrade --dry-run 2>&1 | head -n 2
ERROR Unable to read
ERROR failed to load configuration: No such file or directory (os error 2)
[1] 155988 IOT instruction (core dumped) topgrade --dry-run 2>&1 |
155989 done head -n 2 I don't have a strong view on how we should handle it under such a case (using files under Friendly ping @DottoDev , any thoughts on this? |
Note on |
IMHO there should be the possibility to use |
Should [misc] be required in the files in topgrade.d? |
Best case would be that [misc] isn't required. |
@DottoDev , to confirm:
This way the Please lmk if that makes sense, I'll change the diff to address 3. I'll leave 1. and 2. as is. |
@slowsage seems good, but I don't know if topgrade.toml has to be required if topgrade.d exists, imo it doesn't have to be created in this case. |
@DottoDev , this PR handles exactly that case. i.e no topgrade.toml file => use defaults and apply files in topgrade.d if they exist. No file created. Please accept if it makes sense. |
Lgtm |
When config file(s) exist in
topgrade.d
but notopgrade.toml
exists,ensure()
does not create a default config file. This causes an error asread()
assumes thetopgrade.toml
file exists.This PR assumes the desired behavior is to use just the contents of the files in
topgrade.d
.Else, one could change
ensure()
to createtopgrade.toml
.Standards checklist:
CONTRIBUTING.md
cargo build
)cargo fmt
)cargo clippy
)cargo test
)If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.