id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 226,"store flappserver services in JSON, not separate files",Brian Warner,Brian Warner,"To help with https://github.com/warner/git-foolscap/issues/1 (ex #200), as well as fix a minor security problem with flappserver service lookup, we need to change the way that it stores the service information. Currently (in 0.6.5) these services are stored as a collection of small files, three per service (named `service_type`, `service_args`, and an optional `comment`), in a subdirectory named after the service's swissnum. These all live in a directory named `services` which itself lives inside the flappserver's basedir. The complete path looks like `BASEDIR/services/SWISSNUM/service_type`. The flappserver uses the incoming swissnum to locate the service information, instantiates something according to the service_type, and connects the new service object to the caller. But swissnums are allowed to be pretty arbitrary: git-foolscap puts a slash in them (SWISSNUM/REPONAME) so that ""git clone"" behaves well. And `flappserver list` does a simple `os.listdir(""BASEDIR/services"")` to enumerate the swissnums, which breaks on the embedded slashes (as they wind up creating intermediate directories). So the new plan is: * store service info in a single JSON file, `BASEDIR/services.json` * write one function that loads a dict of services (swissnum -> `{service_type, service_args, comment}`), by loading the JSON file if present, otherwise scanning `services` with `os.walk()` for all `service_type` files and reconstructing swissnums from the (possibly multi-part) paths * use this dict for: * `flappserver list` * service lookup * `flappserver add` (load the dict, add keys, write `services.json`) This will basically force an upgrade if you use `flappserver add` on an old-format basedir, otherwise it'll leave things alone (but use the contents more safely). ",defect,closed,major,0.7.0,appserver,0.6.5,fixed,,