broadinstitute/fiss

RFE: add --force option to config_put

Opened this issue · 5 comments

If a config already exists in a workspace, config_put will fail. We should add a --force option that will first validate the update, then delete the existing config before pushing the updated one.

In the meantime you might try config_copy ... it does the delete

Looking at the code, there is a low-level API for this already in api.py, but it has not yet been implemented in fiss.py - update_workspace_config()

I would prefer not to have multiple HL routines which do essentially the same thing, tho. An update is just a put that overwrites the previous (i.e. deletes it first).

Then it sounds like the simplest solution is to have fissfc config_put -f call update_workspace_config()

Maybe, but I suspect the code will need to check if the config exists first in either case .. because we shouldn't allow an accidental "-f on a config that doesn't already exist" to throw an error (which according to the RESTful api, it will return 404 in such cases) ... the smarter thing to do, instead, is treat that situation like a "put" ... in which case it seems the cleanest is to replicate the behavior (not necessarily the code) in config_copy: delete first if it already exists ...