Add property ConfigurationAdapter.charm_instance
This patch adds a new property to match with the documentation that claims the ConfigurationAdapter keeps a weak reference to the charm instance. Change-Id: I692a2a2b4ba50fc5833fb9781609ea7e9f114ae3
This commit is contained in:
parent
cf182d849d
commit
20cfba9021
@ -15,6 +15,8 @@
|
||||
"""Adapter classes and utilities for use with Reactive interfaces"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import weakref
|
||||
|
||||
from ops.framework import Object
|
||||
|
||||
|
||||
@ -94,6 +96,7 @@ class ConfigurationAdapter(object):
|
||||
:param charm_instance: the instance of the OpenStackCharm derived
|
||||
class.
|
||||
"""
|
||||
self.charm_instance = weakref.proxy(charm_instance)
|
||||
for k, v in charm_instance.framework.model.config.items():
|
||||
k = k.replace('-', '_')
|
||||
setattr(self, k, v)
|
||||
|
Loading…
x
Reference in New Issue
Block a user