openmicroscopy/openmicroscopy — pull request #651 by joshmoore (2013-01-25 08:12:19+00:00)
Title: Handle read-only etc/grid/config.xml files (See #10187) (rebased onto develop)

This is the same as gh-641 but rebased onto develop.

----

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