When running secret-add and secret-set hook commands in same hook context, the created secret resources kept in provider side even the secret-set was failed

Bug #1992547 reported by Yang Kelvin Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
High
Yang Kelvin Liu

Bug Description

$ juju exec --unit hello-kubecon/0 'uri=$(secret-add --owner unit foo=unit1); echo $uri; secret-set $uri --label=aaa;'
secret:cd34kcuffbarderrtpj0
creating secrets: secret with label "aaa" already exists

# secret-add created the `cd34kcuffbarderrtpj0-1` in k8s side, but Juju gave up to save metadata in database because we got label conflict.

$ mkubectl -nt1 get secret/cd34kcuffbarderrtpj0-1
NAME TYPE DATA AGE
cd34kcuffbarderrtpj0-1 Opaque 1 7m6s

$ juju show-secret cd34kcuffbarderrtpj0 --reveal
{}
ERROR secret "cd34kcuffbarderrtpj0" not found

Fix: we should delete the `secret/cd34kcuffbarderrtpj0-1` if we cannot save the secret metadata successfully.

Changed in juju:
importance: Undecided → High
status: New → Triaged
milestone: none → 3.0-beta5
Harry Pidcock (hpidcock)
Changed in juju:
milestone: 3.0-beta5 → 3.0-rc2
Changed in juju:
milestone: 3.0-rc2 → 3.0-rc3
Changed in juju:
milestone: 3.0-rc3 → 3.0.1
Changed in juju:
milestone: 3.0.1 → 3.0.2
Changed in juju:
milestone: 3.0.2 → 3.0.3
Changed in juju:
assignee: nobody → Yang Kelvin Liu (kelvin.liu)
Changed in juju:
milestone: 3.0.3 → 3.0.4
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.