Read the environment with typed parsers and apply the documented defaults
set_defaults() assigned os.getenv() results directly, which overwrote the argparse defaults with None whenever a variable was unset. A default container therefore ran "seaf-cli config -k delete_confirm_threshold -v None", and the same for upload_limit and download_limit: none of the three documented defaults were ever applied. SEAFILE_UID and SEAFILE_GID had a second problem. argparse type=int applies only to command line flags, never to set_defaults, so both stayed strings. The check in setup_uid compares them against pwd integers, and a string is never equal to one, so usermod ran on every start. dsc/config.py reads each variable with its documented default and rejects a malformed or negative value at startup, naming the variable, instead of passing it on. An empty variable counts as unset. Booleans are now rendered as true and false rather than Python's True and False. The daemon reads disable_verify_certificate with its boolean accessor, which does not recognise the capitalised form. I could not run the daemon to confirm the previous value's effect, since the AppImage is x86_64 only. seaf-cli is no longer given a None value for any option.
This commit is contained in:
1 parent
87b76b80f6
commit
e6034a69a6
8 files changed
+283
-26
No files matched your search
+13
-6
@@ -84,12 +84,19 @@ Acceptance criteria:
|
||||
|
||||
### Correct environment parsing and defaults
|
||||
|
||||
- [ ] Replace direct `os.getenv()` assignments in `start.py` with typed parsers.
|
||||
- [ ] Preserve the documented defaults for upload limit, download limit, and
|
||||
delete-confirm threshold when variables are absent.
|
||||
- [ ] Validate UID, GID, limits, threshold, and booleans before daemon startup.
|
||||
- [ ] Reject negative and malformed numeric values with useful messages.
|
||||
- [ ] Do not pass `None` as a Seafile configuration value.
|
||||
- [x] Replace direct `os.getenv()` assignments in `start.py` with typed parsers.
|
||||
See `dsc/config.py` and `defaults_from_env()`.
|
||||
- [x] Preserve the documented defaults for upload limit, download limit, and
|
||||
delete-confirm threshold when variables are absent. They were not: an unset
|
||||
variable overwrote the argparse default with `None`, so a default container
|
||||
sent the literal string `None` for all three.
|
||||
- [x] Validate UID, GID, limits, threshold, and booleans before daemon startup.
|
||||
UID and GID are now integers; as strings they never equalled the integers
|
||||
they were compared against, so `usermod` ran on every start.
|
||||
- [x] Reject negative and malformed numeric values with useful messages.
|
||||
- [x] Do not pass `None` as a Seafile configuration value. Booleans are also
|
||||
rendered as `true`/`false` rather than Python's `True`/`False`, since the
|
||||
daemon reads that setting with its boolean accessor.
|
||||
|
||||
Acceptance criteria:
|
||||
|
||||
|
||||
Reference in new issue
Block a user