Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --set to config append, --report to config {set,append,remove} (rebased onto develop) #4828

Merged
merged 2 commits into from
Sep 9, 2016
Merged

Add --set to config append, --report to config {set,append,remove} (rebased onto develop) #4828

merged 2 commits into from
Sep 9, 2016

Conversation

atarkowska
Copy link
Member

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


What this PR does

Adds --set option to omero config append, to indicate a value should only be added if it's not already in the list, taking into account the defaults, see #4597

Adds --report option to omero config {append,set,remove}. This will always print out Changed: ... if a change was made, and nothing if no change was made.

Testing this PR

  1. Check omero config append/set/remove behaves as before.

  2. Try something like

    omero config append --set omero.web.ui.top_links '["History", "history", {"title": "History"}]'
    

    this should have no effect (E.g. omero config get, or omero web restart and check the top-links) because this value is part of the standard defaults.

  3. Try it without --set, you should see the old behaviour i.e. the duplicate value is appended

    omero config append omero.web.ui.top_links '["History", "history", {"title": "History"}]'
    
  4. Add a different value, e.g.

    omero config append --set omero.web.ui.top_links '["BBC", "http://www.bbc.co.uk/"]'
    
  5. Try omero config {append,set,remove} --report. If a change was made you should see a message such as Changed: Appended omero.web.ui.top_links:["BBC", "http://www.bbc.co.uk/"]

The idea behind this is to assist with Ansible deployments where you want to programmatically know whether or not a change was made.

Related reading

This will only add a value if it's not already in the list
See #4597
@atarkowska
Copy link
Member Author

--rebased-from #4791

@atarkowska atarkowska closed this Sep 8, 2016
@atarkowska atarkowska reopened this Sep 8, 2016
@joshmoore
Copy link
Member

Thanks for opening this. See naming discussion under #4791 (comment)

@joshmoore
Copy link
Member

[hudson@ome-c6100-1 dist]$ bin/omero config append --set --report josh.test '"foo"'
Changed: Appended josh.test:"foo"
[hudson@ome-c6100-1 dist]$ bin/omero config append --set --report josh.test '"foo"'
[hudson@ome-c6100-1 dist]$ bin/omero config append --set --report josh.test '"bar"'
Changed: Appended josh.test:"bar"
[hudson@ome-c6100-1 dist]$ bin/omero config append --report josh.test '"bar"'
Changed: Appended josh.test:"bar"
[hudson@ome-c6100-1 dist]$ bin/omero config get josh.test
["foo", "bar", "bar"]
[hudson@ome-c6100-1 dist]$ bin/omero config set josh.test
[hudson@ome-c6100-1 dist]$

@joshmoore
Copy link
Member

Tests pass as they did on metadata52. I've listed this PR for API review based on the naming discussion linked above.

@joshmoore joshmoore merged commit 3a913ee into ome:develop Sep 9, 2016
@joshmoore joshmoore deleted the rebased/develop/config-exists branch September 9, 2016 07:13
@sbesson sbesson added this to the 5.3.0 milestone Sep 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants