Do not execute certificate handlers in update-status hook

The certificate handler code does a bit of work and should not
run during the update-status hook.

As documented in the charms.reactive dispatch [0] function
handlers registered with the @hook decorator will execute before
other handlers.  So we can rely on the 'is-update-status-hook'
flag being consistently set when in update-status hook before
other handlers are evaluated for dispatch.

0: 3d27f3d24a/charms/reactive/bus.py (L325)

Closes-Bug: #1954748
Change-Id: I4a3aa544f98049c83db576f95de826038e8e1afc
This commit is contained in:
Frode Nordahl 2021-12-14 11:43:06 +01:00
parent 5999eeaa5d
commit 93bc9e1837
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
1 changed files with 2 additions and 0 deletions

View File

@ -125,6 +125,7 @@ def default_post_series_upgrade():
@reactive.when('certificates.available',
'charms.openstack.do-default-certificates.available')
@reactive.when_not('is-update-status-hook')
def default_request_certificates():
"""When the certificates interface is available, this default handler
requests TLS certificates.
@ -141,6 +142,7 @@ def default_request_certificates():
@reactive.when_any(
'certificates.ca.changed',
'certificates.certs.changed')
@reactive.when_not('is-update-status-hook')
def default_configure_certificates():
"""When the certificates interface is available, this default handler
updates on-disk certificates and switches on the TLS support.