canonical / canonical/layer-basic

config states use hookenv.Config.changed, which can fail

Open
#67 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
42
PR merge metrics
No merged PRs in 30d

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()

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at charms.layer.basic.init_config_states() and inspect how configuration changes are currently detected through hookenv.config(). Read the unitdata.kv() usage around the base layer, then verify that the cache is updated only during init_config_states() and that changes are not lost when an action runs before a configuration hook.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.