secret-set creates a new revision when the contents are unchanged

Bug #2069238 reported by Tony Meyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Committed
High
Ian Booth

Bug Description

Calling secret-set with the same contents as the latest revision creates a new revision. For example:

```shell
$ juju exec -u dummycharm/0 secret-add sssssh=nottelling
secret://896a3e9b-bd99-4e8a-853a-129e6af54a22/cpl69kfmp25c76iug9lg
$ juju secrets
ID Name Owner Rotation Revision Last updated
cpl69kfmp25c76iug9lg - dummycharm never 1 31 seconds ago
$ juju exec -u uptime/0 secret-set secret://896a3e9b-bd99-4e8a-853a-129e6af54a22/cpl69kfmp25c76iug9lg sssssh=nottelling
$ juju exec -u uptime/0 secret-set secret://896a3e9b-bd99-4e8a-853a-129e6af54a22/cpl69kfmp25c76iug9lg sssssh=nottelling
$ juju secrets
ID Name Owner Rotation Revision Last updated
cpl69kfmp25c76iug9lg - uptime never 3 2 minutes ago
```

This is understandable because the controller doesn't know what the content is. Charm code should also be written such that content is only set when the charm knows that the content has been updated.

However, we have found that it is easy for charmers to run afoul of this behaviour, and inadvertently create huge numbers of revisions (that then cause performances issues with Juju, particularly if they are also not properly removed).

It would nicer if `secret-set` was idempotent (as other hook tools are).

This would be better achieved in Juju than in ops, because Juju could (for example) keep a hash of the secret content to determine whether it has changed, whereas ops would have to always request the content in order to know if it has changed.

Tags: secrets
Ian Booth (wallyworld)
tags: added: secrets
Changed in juju:
milestone: none → 3.6-beta2
assignee: nobody → Ian Booth (wallyworld)
importance: Undecided → High
status: New → In Progress
Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Revision history for this message
Ben Hoyt (benhoyt) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.