Code review comment for lp:~timkuhlman/charms/trusty/grafana/layer-grafana-http

Tim Kuhlman (timkuhlman) wrote :

data_changed does work but reports on the data changed since the last time it was run not since the last hook. So what was happening was that when the config_changed hook would fire the function check_config would get called since grafana was already started. It does a data_changed call found out the data changed and would call setup_grafana, setup_grafana would run and do another data_changed call which found nothing had changed since the last run of the command in the check_config function and so would skip over the actual code update. By removing the second data_changed call I fixed that problem.

It is possible that on initial install or if grafana is not running setup_grafana will be called and then on the next config_changed hook check_config will call setup_grafana a second time. I didn't fully trace the logic through of that initial setup but thought a double config in that case is a lot better than failing to update after config-changed.

« Back to merge proposal