Goal
I wasn't able to develop Obnam 3 last week, so this week I'm doing a session on Saturday.
Last time I implement subcommands for managing a chunk store. This
time I'll integrate the chunk store to obnam chunk subcommands.
Plan
- Add a global option
obnam --chunks DIRthat sets chunk store location. - Change
obnam storecommands to use the location set with the global option. Remove any location arguments from subcommands. - Change
obnam chunk encodeto use the global chunk store location, if an explicit filename isn't set. - Likewise
obnam chunk decrypt. - Likewise
obnam chunk inspect.
Notes
Prelude
- Verify that tests still pass. They do.
Add global --repository option
On reflection,
--chunksisn't a particularly clean option name, from a user point of view. It requires understanding that backups are stored as chunks. I'll use the option--repositoryinstead. Since that is a long option name, I'll allow the alias-ras well.Added the option.
Changed the
obnam storesubcommands to use the store location set with the option. Some day will want to add a configuration file that can set this, but one change at a time.For the
obnam chunksubcommands I'll want to continue to support using chunks without using the chunk store. However, I'll want to make using the store the default.For
obnam chunk encryptthere is already an--outputoption. If that's not used, fall back to using the chunk store. This means the command will lose the possibility of writing to the standard output. I can add that back later if there's a need.For
obnam chunk decryptthe chunk file is named on the command line. I'll change the subcommand to require either an option--idto specify the ID of a chunk in the chunk store, or--filenameto specify a filename.Likewise for
obnam chunk inspect.For testing this I will need to capture the chunk id in some way so that a later step can refer to it. Given how primitive the Subplot libraries for capturing output is, I'll want to avoid that. Instead, I'll add an option
--idtoobnam chunk encryptthat sets the ID. By default it picks a random one.OK, after uninteresting side steps got this working.
Refactored code to reduce duplication by adding some helper functions the the
Leaftrait to get or open the chunk repository.
Tidy up
- Removed various
eprintlncalls for debugging and other cruft left in the coded base. - Verified that CI is happy.
- Merged.
Summary
I reached my goal, and now obnam make use of the repository more
convenient.
Comments?
If you have feedback on this development session, please use the following fediverse thread: https://toot.liw.fi/@liw/114641233721923242.