canonical / canonical/layer-basic
config states use hookenv.Config.changed, which can fail
- Langage dominant
- Python
- Étoiles
- 10
- Forks
- 42
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
The config states detect if a configuration item has changed using hookenv.config() and its changed method. This was designed assuming the only thing running in a hook context is a hook, which is now untrue. It is possible for an action to be invoked, which can check charm configuration using hookenv.config() and will flag changed config items as seen. If this action happens to be called between the config being changed and an actual hook being called (such as config-changed), then the configuration changed states will be lost.
The solution is for the base layer to cache the config itself in unitdata.kv(), so the cache only gets updated in charms.layer.basic.init_config_states()
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par charms.layer.basic.init_config_states() et examinez comment les changements de configuration sont actuellement détectés via hookenv.config(). Lisez l’utilisation de unitdata.kv() autour de la couche de base, puis vérifiez que le cache n’est mis à jour que pendant init_config_states() et que les changements ne sont pas perdus lorsqu’une action s’exécute avant un hook de configuration.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100