pcdshub / happi

Heuristic Access to Positions of Photon Instruments
https://pcdshub.github.io/happi/master
Other
13 stars 29 forks source link

happi "superuser edit" utility? #169

Open klauer opened 4 years ago

klauer commented 4 years ago

A few obvious options to me on how to deal with edits to the primary database:

  1. Provide a happi superuser-edit-style script which does something like the following:

    • cp $HAPPI_CFG /tmp/path
    • $EDITOR /tmp/path
    • Use json_pp or happi audit or something similar to ensure the edits are OK
    • Ensure the original file hasn't changed; show the user a diff
    • Update the source file
  2. Require a PR for such changes by convention (adding CI to check the database format)

  3. Add a git hook: pre-receive might work to reject any invalid files (Not 100% sure this would work), removing the need for PRs but still requiring version controlling the changes withgit

ZLLentz commented 4 years ago

It seems completely reasonable to me to lean in to the superuser's desire to do direct edits and try to make it as easy and seamless as possible. After all, the json database files are very human read/writeable. With some sort of auditing/validation included this becomes very appealing.

This could even be extended to other backends e.g. mongodb by doing a database dump to a json file and then pushing the json changes to the mongodb.