Repository navigation
This release exposes the model's juju-*-proxy settings through ops. In ops.testing, ctx.on now returns a public Event class, and ops.hookcmds now returns all the data that Juju's hook commands output.
We also improved the documentation, including:
- Published guidance about setting up production integrations. This summarises the integrations that production charms often need to support.
- Refreshed the machine charm tutorial and Kubernetes charm tutorial to be fully compatible with the latest Charmcraft release (version 4.5).
Breaking changes
ops.hookcmds now returns all the data that Juju's hook commands output. If a hook command does not exist, such as the secret_* commands on Juju 2.9, ops.hookcmds raises hookcmds.Error. See #2805.
If you were catching FileNotFoundError from ops.hookcmds, you'll need to catch hookcmds.Error instead. ops.Model continues to raise FileNotFoundError in the places it did before.
Access to model proxy configuration
Charms can now read the model's juju-http-proxy, juju-https-proxy and juju-no-proxy configuration from Model.proxy_config. Previously, charms had to read os.environ. ops.JujuContext also has new http_proxy, https_proxy and no_proxy attributes. See the ops.ProxyConfig documentation and the JujuContext documentation.
Juju doesn't fire an event when the proxy configuration changes, so access and apply the values in a reconciler:
proxy = self.model.proxy_config
if proxy.https:
environment['HTTPS_PROXY'] = proxy.https
if proxy.no:
environment['NO_PROXY'] = ','.join(proxy.no)In state-transition tests, set the values with ProxyConfig on the model:
state = testing.State(model=testing.Model(proxy_config=testing.ProxyConfig(https='http://proxy:3128')))Changelog
Breaking Changes
- Fix:
ops.hookcmdsreturns all the data that the hook commands output (#2805)
Features
- Make the testing event class public as
ops.testing.Event(#2760) - Model juju-*-proxy model configs from Juju (#2832)
- Add a typed JSON encoding of
ops.testing.Statefor worker processes (#2828)
Fixes
- Avoid exponential backtracking in the
ops.testingstorage name check (#2800) ops.testing.Containerfallback type checking; ty and pyrefly in ci by @Vivek1106-04 (#2804)- Send the correct OTLP span kind from ops-tracing by @Vivek1106-04 (#2824)
- Preserve zero user and group IDs in Pebble services by @ItsM0rty (#2847)
- Accept tagged Juju versions and type lists in the
ops.testingconsistency checker (#2857) - Preserve zero user and group IDs when merging Pebble exec checks by @nancy6547 (#2867)
- Handle an OSError connecting exec websockets like a websocket error (#2877)
- Close the socket when connecting an exec websocket fails (#2876)
- Wrap errors reading the Pebble response in
ConnectionError(#2875) - Encode bytes, mapping attributes and dropped counts per OTLP/JSON by @Vivek1106-04 (#2827)
- Skip symlinks in push_path, and keep going after a failed file (#2851)
- Use
CheckLevel.UNSETfor an unset level intesting.CheckInfo(#2878) - Decode exec output incrementally, replacing undecodable bytes (#2870)
- Keep the check level when a merged layer does not set one (#2872)
- Keep non-ASCII characters and whitespace in pulled paths (#2871)
- Accept
ops.Portintesting.State, compare ports by value, and report duplicate entities (#2855) - Filter Pebble notices by type in
ops.testingby @Indian-boult (#2917)
Documentation
- Use the pydantic v2 validator in the typed config how-to (#2802)
- Upgrade K8s tutorial to api-demo-server 3.0.0 (#2833)
- Fix the Jubilant module name in the opened ports example (#2844)
- Make the Pebble check and stored state examples run (#2777)
- Remove the Scenario 6 to 7 upgrade guide (#2836)
- Add a how-to set up production integrations guide (#2835)
- Say that
pebble.CheckInfo.levelisUNSETwhen there is no level (#2879) - Minor consistency fixes in Kubernetes tutorial (#2893)
- Update advice about
uv.lock; update example charm dependencies and locking strategy (#2889) - Set
filterwarningstoerrorin example charms; other minor changes to match Charmcraft (#2890) - Prevent file handle leaks in Kubernetes tutorial charms (#2907)
- Reconstruct tutorial charms and prevent linter errors (#2904)
Tests
- Drop unused
MODEL_SETTINGSfrom tox environments and example charms by @sundeep8967 (#2702) - Declare ops-scenario and ops-tracing test dependencies (#2891)
CI
- Update the charm-tech-code pins and use the new release tool options (#2808)
- Use the self-repository syntax for in-repo actions and workflows (#2799)
- Improve the release workflows after the 2.23.6 release (#2812)
- Fix open code scanning alerts (#2840)
- Run the property-tests branch's property tests nightly (#2897)
All commits: 3.9.0...3.10.0
Thanks @Vivek1106-04, @ItsM0rty, @nancy6547, @Indian-boult, and @sundeep8967 for your contributions to this release!