fix(consul-notify): normalize requirer socket path to basename - #35
Merged
ahmad-can merged 1 commit intoJun 9, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the consul-notify provider to normalize the requirer-published UNIX socket path to a basename, ensuring the TCP health check always targets hypervisor/<filename> even when stale relation data contains an older data/<filename> format.
Changes:
- Normalize
unix_socket_filepathto a basename inConsulNotifyProviderfor backward compatibility with older requirers. - Update existing unit tests to use the “bare filename” contract.
- Add a dedicated unit test covering the legacy
data/shutdown.sockrelation value.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/charms/consul_client/v0/consul_notify.py |
Normalizes requirer-provided socket path to basename and bumps lib patch version. |
tests/unit/test_charm.py |
Updates socket-path test inputs to bare filenames and adds a backward-compatibility regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The TCP health-check `--socket-path` is built from the `unix_socket_filepath` published by the requirer over the consul-notify relation, with the `hypervisor/` content-interface directory prepended by the consul-client charm. Older requirers (e.g. an openstack-hypervisor charm predating the content-interface socket-path fix) publish a value that contains a directory component such as `data/shutdown.sock`. When only the consul-client charm is refreshed, the relation databag still holds this stale value, so the rendered path becomes `hypervisor/data/shutdown.sock`, which does not exist in the snap namespace and makes every nic-down alert fail with ENOENT. Normalize the requirer-provided value to its basename in the ConsulNotifyProvider, so consumers always receive just the socket file name regardless of the format published by the requirer. The rendered path is then always `hypervisor/<filename>`, decoupling consul-client from requirer upgrade ordering and stale relation data. Default unit tests now feed a bare filename (the current contract); a dedicated test covers the old `data/shutdown.sock` format for backward compatibility. Assisted-By: claude-opus-4.8 Signed-off-by: Hemanth Nakkina <hemanth.nakkina@canonical.com>
hemanthnakkina
force-pushed
the
fix/socket-path-basename-on-upgrade
branch
from
June 9, 2026 03:56
9552e64 to
d968861
Compare
ahmad-can
reviewed
Jun 9, 2026
ahmad-can
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TCP health-check
--socket-pathis built from theunix_socket_filepathpublished by the requirer over the consul-notify relation, with thehypervisor/content-interface directory prepended by the consul-client charm.Older requirers (e.g. an openstack-hypervisor charm predating the content-interface socket-path fix) publish a value that contains a directory component such as
data/shutdown.sock. When only the consul-client charm is refreshed, the relation databag still holds this stale value, so the rendered path becomeshypervisor/data/shutdown.sock, which does not exist in the snap namespace and makes every nic-down alert fail with ENOENT.Normalize the requirer-provided value to its basename in the ConsulNotifyProvider, so consumers always receive just the socket file name regardless of the format published by the requirer. The rendered path is then always
hypervisor/<filename>, decoupling consul-client from requirer upgrade ordering and stale relation data.Default unit tests now feed a bare filename (the current contract); a dedicated test covers the old
data/shutdown.sockformat for backward compatibility.Assisted-By: claude-opus-4.8