Skip to content

Commit

Permalink
fix: Juju passes the expiry in a field 'expiry', not 'expires' (#1317)
Browse files Browse the repository at this point in the history
`secret-info-get` gives the expiry back in a field called "expiry":

```
$ juju exec --unit thirteensixteen/0 -- secret-info-get cqv88thtvhl393c8hs20
cqv88thtvhl393c8hs20:
  revision: 1
  label: food
  owner: application
  rotation: daily
  expiry: 2024-09-04T23:12:09Z
  rotates: 2024-08-16T23:12:10Z
```

We were incorrectly looking for it in a field called "expires", which is
the attribute name we use.

Fixes #1316
  • Loading branch information
tonyandrewmeyer authored Aug 16, 2024
1 parent 449793f commit 43b5af9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ def __init__(
@classmethod
def from_dict(cls, id: str, d: Dict[str, Any]) -> 'SecretInfo':
"""Create new SecretInfo object from ID and dict parsed from JSON."""
expires = typing.cast(Optional[str], d.get('expires'))
expires = typing.cast(Optional[str], d.get('expiry'))
try:
rotation = SecretRotate(typing.cast(Optional[str], d.get('rotation')))
except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion test/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,7 @@ def test_from_dict(self):
{
'label': 'fromdict',
'revision': 8,
'expires': '2022-12-09T14:10:00Z',
'expiry': '2022-12-09T14:10:00Z',
'rotation': 'yearly',
'rotates': '2023-01-09T14:10:00Z',
},
Expand Down

0 comments on commit 43b5af9

Please # to comment.