openmicroscopy/openmicroscopy — pull request #641 by joshmoore (2013-01-23 14:02:34+00:00)
Title: Handle read-only etc/grid/config.xml files (See #10187)

For installations which should not be modified by non-syadmins, it is useful
to allow the etc/grid/config.xml to be locked
(chmod 444). The only limitation is that the modification of the active
profile can no longer be modified via OMERO_CONFIG or `bin/omero config def`.

All calls to `bin/omero config` which would modify config.xml now print an
error message. (`bin/omero config def` is somewhat special since without an
argument it does not modify config.xml but with an argument it does)

Similarly, all calls to `bin/omero admin` check that either the file is
lockable or that no profile has been selected.

# Testing #

All the usual commands in `admin` and `config` should be checked with a
regular config.xml. I.e.

- [ ] `bin/omero admin start`
- [ ] `bin/omero admin stop`
- [ ] `bin/omero admin restart`
- [ ] `bin/omero config set`
- [ ] `OMERO_CONFIG=foo bin/omero config set`
- [ ] `bin/omero config get`
- [ ] `OMERO_CONFIG=foo bin/omero config get`
- [ ] `bin/omero config load`

Then, the file should be made read-only (`chmod 444 etc/grid/config.xml`).
Of the above commands, the following should fail:

- [ ] `bin/omero config set`
- [ ] `OMERO_CONFIG=foo bin/omero config set`
- [ ] `OMERO_CONFIG=foo bin/omero config get`
- [ ] `bin/omero config load`

/cc @sbesson