Skip to content

Commit

Permalink
docs: note about repeatedly setting secret value in Juju 3.6 (canonic…
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaqq and tonyandrewmeyer authored Sep 10, 2024
1 parent f43ac80 commit d3b878e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
10 changes: 8 additions & 2 deletions docs/custom_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def run(self):
messages = []
if self.content:
node += self.parse_content_to_nodes()
classes = ['versionmodified', self.change, 'jujuversion']
classes = ['versionmodified', self.change]
if len(node) > 0 and isinstance(node[0], nodes.paragraph):
# The contents start with a paragraph.
if node[0].rawsource:
Expand Down Expand Up @@ -418,11 +418,17 @@ class JujuAdded(JujuVersion):
text = 'Added'


class JujuChanged(JujuVersion):
change = 'changed'
text = 'Changed'


class JujuRemoved(JujuVersion):
change = 'removed'
text = 'Scheduled for removal'


def setup(app):
app.add_directive('jujuversion', JujuAdded)
app.add_directive('jujuadded', JujuAdded)
app.add_directive('jujuchanged', JujuChanged)
app.add_directive('jujuremoved', JujuRemoved)
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sphinx==8.0.2
# sphinx-tabs
# sphinxcontrib-jquery
# sphinxext-opengraph
sphinx-autobuild==2024.4.16
sphinx-autobuild==2024.9.3
# via ops (pyproject.toml)
sphinx-basic-ng==1.0.0b2
# via furo
Expand Down
22 changes: 11 additions & 11 deletions ops/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def restore(self, snapshot: Dict[str, Any]):
class PebbleCustomNoticeEvent(PebbleNoticeEvent):
"""Event triggered when a Pebble notice of type "custom" is created or repeats.
.. jujuversion:: 3.4
.. jujuadded:: 3.4
"""


Expand Down Expand Up @@ -884,7 +884,7 @@ class PebbleCheckFailedEvent(PebbleCheckEvent):
if the check is currently failing, check the current status with
``event.info.status == ops.pebble.CheckStatus.DOWN``.
.. jujuversion:: 3.6
.. jujuadded:: 3.6
"""


Expand All @@ -895,7 +895,7 @@ class PebbleCheckRecoveredEvent(PebbleCheckEvent):
state (not simply failed, but failed at least as many times as the
configured threshold).
.. jujuversion:: 3.6
.. jujuadded:: 3.6
"""


Expand Down Expand Up @@ -944,7 +944,7 @@ class SecretChangedEvent(SecretEvent):
:meth:`event.secret.get_content() <ops.Secret.get_content>` with ``refresh=True``
to tell Juju to start tracking the new revision.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
Charm secrets added in Juju 3.0, user secrets added in Juju 3.3
"""

Expand All @@ -956,7 +956,7 @@ class SecretRotateEvent(SecretEvent):
be rotated. The event will keep firing until the owner creates a new
revision by calling :meth:`event.secret.set_content() <ops.Secret.set_content>`.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

def defer(self) -> NoReturn:
Expand All @@ -983,7 +983,7 @@ class SecretRemoveEvent(SecretEvent):
remove the now-unused revision. If the charm does not, then the event will
be emitted again, when further revisions are ready for removal.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

def __init__(self, handle: 'Handle', id: str, label: Optional[str], revision: int):
Expand Down Expand Up @@ -1020,7 +1020,7 @@ class SecretExpiredEvent(SecretEvent):
must be removed. The event will keep firing until the owner removes the
revision by calling :meth:`event.secret.remove_revision() <ops.Secret.remove_revision>`.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

def __init__(self, handle: 'Handle', id: str, label: Optional[str], revision: int):
Expand Down Expand Up @@ -1213,29 +1213,29 @@ class CharmEvents(ObjectEvents):
"""Triggered by Juju on the observer when the secret owner changes its contents (see
:class:`SecretChangedEvent`).
.. jujuversion:: 3.0
.. jujuadded:: 3.0
Charm secrets added in Juju 3.0, user secrets added in Juju 3.3
"""

secret_expired = EventSource(SecretExpiredEvent)
"""Triggered by Juju on the owner when a secret's expiration time elapses (see
:class:`SecretExpiredEvent`).
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

secret_rotate = EventSource(SecretRotateEvent)
"""Triggered by Juju on the owner when the secret's rotation policy elapses (see
:class:`SecretRotateEvent`).
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

secret_remove = EventSource(SecretRemoveEvent)
"""Triggered by Juju on the owner when a secret revision can be removed (see
:class:`SecretRemoveEvent`).
.. jujuversion:: 3.0
.. jujuadded:: 3.0
"""

collect_app_status = EventSource(CollectStatusEvent)
Expand Down
14 changes: 9 additions & 5 deletions ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def get_secret(self, *, id: Optional[str] = None, label: Optional[str] = None) -
again, unless ``refresh=True`` is used, or :meth:`Secret.set_content`
has been called.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
Charm secrets added in Juju 3.0, user secrets added in Juju 3.3
Args:
Expand Down Expand Up @@ -465,7 +465,7 @@ def add_secret(
) -> 'Secret':
"""Create a :class:`Secret` owned by this application.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
Args:
content: A key-value mapping containing the payload of the secret,
Expand Down Expand Up @@ -1246,7 +1246,7 @@ class Secret:
All secret events have a :code:`.secret` attribute which provides the
:class:`Secret` associated with that event.
.. jujuversion:: 3.0
.. jujuadded:: 3.0
Charm secrets added in Juju 3.0, user secrets added in Juju 3.3
"""

Expand Down Expand Up @@ -1460,6 +1460,10 @@ def set_content(self, content: Dict[str, str]):
secret no longer exists, this method will succeed, but the unit will go
into error state on completion of the current Juju hook.
.. jujuchanged:: 3.6
A new secret revision will *not* be created if the content being set
is identical to the latest revision.
Args:
content: A key-value mapping containing the payload of the secret,
for example :code:`{"password": "foo123"}`.
Expand Down Expand Up @@ -2939,7 +2943,7 @@ def send_signal(self, sig: Union[int, str], *service_names: str):
def get_notice(self, id: str) -> pebble.Notice:
"""Get details about a single notice by ID.
.. jujuversion:: 3.4
.. jujuadded:: 3.4
Raises:
ModelError: if a notice with the given ID is not found
Expand All @@ -2964,7 +2968,7 @@ def get_notices(
See :meth:`ops.pebble.Client.get_notices` for documentation of the
parameters.
.. jujuversion:: 3.4
.. jujuadded:: 3.4
"""
return self._pebble.get_notices(
users=users,
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ description = Live development: build the Sphinx docs with autoreloading enabled
deps = {[testenv:docs]deps}
commands_pre =
{[testenv:docs]commands_pre}
# https://github.com/sphinx-doc/sphinx-autobuild/issues/170
change_dir = {tox_root}/docs
commands =
sphinx-autobuild ./ ./_build/html --watch . --port 8000
sphinx-autobuild docs/ docs/_build/html --watch ops/ --port 8000 {posargs}

[testenv:fmt]
description = Apply coding style standards to code
Expand Down

0 comments on commit d3b878e

Please sign in to comment.