Small layer options API change

In order to make layer options available to charms using different base layers than layer:basic (such as k8s charms), the handling of layer options was split into its own layer, layer:options. This layer is already included by layer:basic, so you don’t need to explicitly include it in your charm’s layer.yaml; charms should continue working without modification.

However, due to the fact that charms.layer.options is now a proper module, the interface had to change slightly. The old API for getting layer options is now deprecated and I’d like to encourage everyone to update to the new API (though a bit of a hack was used to maintain backwards compatibility and allow for the transition period).

The change required is pretty minimal. The old convention was to call charms.layer.options directly:

from charms import layer

layer.options('section')

The new convention just adds get:

layer.options.get('section')

You can also now provide a specific option name to get that one value, rather than the entire dict of options:

layer.options.get('section', 'option')

# can still do this, too, if you want
layer.options.get('section')['option']

Thanks for your understanding.

Also, if you rebuilt any trusty charms in the past day or so, you may have hit the error TypeError: __class__ assignment: only for heap types which was caused by this change. This has been resolved and rebuilding your charms again will fix them. Apologies for the hiccup.

Thanks for the heads up.