Skip to content

Fix/lp 2158343 invalid backend names#870

Merged
gboutry merged 3 commits into
canonical:mainfrom
cngovanduc:fix/lp-2158343-invalid-backend-names
Jul 2, 2026
Merged

Fix/lp 2158343 invalid backend names#870
gboutry merged 3 commits into
canonical:mainfrom
cngovanduc:fix/lp-2158343-invalid-backend-names

Conversation

@cngovanduc

Copy link
Copy Markdown

Root cause:
The check in sunbeam-python/sunbeam/storage/base.py:91 is overly strict:

if any(char.isdigit() for char in last_part):
    return False

This rejects any name where the last segment (after the final hyphen) contains any digit character. For my-hpe3par, it splits to ["my", "hpe3par"] and the last part "hpe3par" contains the digit 3, so it's rejected.

The fix is a one-line change in sunbeam-python/sunbeam/storage/base.py:91:

# Before (too strict):
if any(char.isdigit() for char in last_part):
    return False


# After (correct behavior):
if last_part.isdigit():
    return False

I have also added the related tests in tox

Changed the overly strict digit check from:
if any(char.isdigit() for char in last_part):
to:
if last_part.isdigit():
This now only rejects names where the segment after the final hyphen is entirely numeric (like my-app-1), which would conflict with Juju's unit naming scheme. Names like my-hpe3par where the last segment contains a mix of letters and digits are now correctly accepted.
Comment thread sunbeam-python/sunbeam/storage/base.py Outdated
Comment thread sunbeam-python/tests/unit/sunbeam/storage/test_base.py
Use the standard JUJU pattern

Co-authored-by: hmlanigan <heather.lanigan@canonical.com>
@gboutry
gboutry merged commit 8b3d860 into canonical:main Jul 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants