Skip to content

Parsing of storage constraints fails #1093

@reneradoi

Description

@reneradoi

Description

Hi Team!

After upgrading our libs to 3.5.2 one of our integration test fails with this error:

[...]
File "/home/ubuntu/actions-runner/_work/opensearch-operator/opensearch-operator/.tox/integration/lib/python3.10/site-packages/juju/constraints.py", line 131, in parse_storage_constraint
    for m in STORAGE.finditer(constraint):
TypeError: expected string or bytes-like object

This is presumably due to #1053, which added parsing the storage constraints by applying re.finditer() on the given constraints. But as some of these (e.g. size) are integers and no strings, this fails.

We define the storage constraints like this: storage = {"opensearch-data": {"pool": "opensearch-pool", "size": 2048}} This cannot be changed to string as per https://github.com/juju/python-libjuju/blob/main/juju/client/_definitions.py#L6531-L6532.

Urgency

Annoying bug in our test suite

Python-libjuju version

3.5.2.0

Juju version

3.4.3, 3.5.3

Reproduce / Test

storage = {"opensearch-data": {"pool": "opensearch-pool", "size": 2048}}
ops_test.model.deploy(my_charm, num_units=1, series=SERIES, storage=storage)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions