Skip to content

Specify content interface socket directory path#33

Merged
hemanthnakkina merged 2 commits intocanonical:mainfrom
ahmad-can:socket-path-prefix
Apr 2, 2026
Merged

Specify content interface socket directory path#33
hemanthnakkina merged 2 commits intocanonical:mainfrom
ahmad-can:socket-path-prefix

Conversation

@ahmad-can
Copy link
Copy Markdown
Collaborator

Issue

set socket directory prefix via config builder instead of relation data

@ahmad-can ahmad-can force-pushed the socket-path-prefix branch from f2cd531 to 59ac30c Compare March 26, 2026 06:58
Comment thread charmcraft-24.04.yaml Outdated
charm:
charm-binary-python-packages:
- pydantic
- ops
Copy link
Copy Markdown
Collaborator Author

@ahmad-can ahmad-can Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @gboutry @hemanthnakkina - if we don't pin this, the charmpack start failing from this week

charmcraft pack
Failed to run the build script for part 'charm'.
Detailed information: 
:: + env -i LANG=C.UTF-8 LC_ALL=C.UTF-8 CRYPTOGRAPHY_OPENSSL_NO_LEGACY=true PIP_CONSTRAINT=/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/parts/plugins/charm-constraints.txt PATH=/snap/charmcraft/7517/libexec/charmcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin SNAP=/snap/charmcraft/7517 SNAP_ARCH=amd64 SNAP_NAME=charmcraft SNAP_VERSION=4.0.1 /snap/charmcraft/7517/bin/python -u -I /snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py --builddir /root/parts/charm/build --installdir /root/parts/charm/install --entrypoint /root/parts/charm/build/src/charm.py -p pip -p setuptools -p wheel -b pydantic -r requirements.txt
:: Traceback (most recent call last):
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 499, in <module>
::     main()
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 494, in main
::     builder.build_charm()
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 95, in build_charm
::     self.handle_dependencies()
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 368, in handle_dependencies
::     self._install_dependencies(staging_venv_dir)
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/instrum.py", line 152, in _f
::     return func(*args, **kwargs)
::            ^^^^^^^^^^^^^^^^^^^^^
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 298, in _install_dependencies
::     _process_run(
::   File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/charm_builder.py", line 428, in _process_run
::     raise RuntimeError(
:: RuntimeError: Subprocess command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--no-binary=:all:', '--requirement=requirements.txt'] execution failed with retcode 1
Recommended resolution: Check the build output and verify the project can work with the 'charm' plugin.
For more information, check out: https://documentation.ubuntu.com/charmcraft/4.0.1/reference/plugins/
Failed to run charmcraft in instance

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run in verbose? I've been fixing rust type issues recently

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not reoccurring anymore

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how the Consul TCP health-check script is configured to locate the consul-notify Unix socket by prepending a fixed content-interface directory prefix from the config builder, rather than relying on relation-provided paths.

Changes:

  • Add ConsulConfigBuilder.HYPERVISOR_SOCKET_PREFIX and use it to prefix --socket-path in generated Consul service check args.
  • Update unit tests to assert the prefixed socket path.
  • Add ops to charm-binary-python-packages in the 22.04/24.04 charmcraft configs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/unit/test_charm.py Updates assertions to expect the socket path to be prefixed via ConsulConfigBuilder.HYPERVISOR_SOCKET_PREFIX.
src/config_builder.py Prepends a fixed directory (hypervisor/) to the --socket-path argument in the Consul check configuration.
charmcraft-24.04.yaml Adds ops to packaged Python dependencies for the 24.04 build config.
charmcraft-22.04.yaml Adds ops to packaged Python dependencies for the 22.04 build config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/config_builder.py
@ahmad-can ahmad-can force-pushed the socket-path-prefix branch 2 times, most recently from efd3ebb to 03705db Compare March 26, 2026 13:31
@ahmad-can ahmad-can requested a review from Copilot March 26, 2026 13:33
@ahmad-can ahmad-can force-pushed the socket-path-prefix branch from 03705db to 22a2d82 Compare March 26, 2026 13:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/charms/consul_client/v1/consul_notify.py Outdated
Comment thread lib/charms/consul_client/v1/consul_notify.py Outdated
@ahmad-can ahmad-can force-pushed the socket-path-prefix branch 5 times, most recently from 8a349a1 to c670a82 Compare March 27, 2026 05:39
@ahmad-can ahmad-can force-pushed the socket-path-prefix branch 3 times, most recently from b4c6696 to f26bb2b Compare March 30, 2026 09:59
@ahmad-can ahmad-can force-pushed the socket-path-prefix branch from f26bb2b to 4a6d91e Compare March 31, 2026 06:05
@hemanthnakkina hemanthnakkina merged commit 52697a9 into canonical:main Apr 2, 2026
17 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.

4 participants