Skip to content

Update hardware-exporter templates - #552

Merged
chanchiwai-ray merged 1 commit into
mainfrom
regression/bug551
Sep 10, 2026
Merged

chanchiwai-ray merged 1 commit into
mainfrom
regression/bug551

Conversation

@chanchiwai-ray

@chanchiwai-ray chanchiwai-ray commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

uv plugin changed site-package layout from

  • charm plugin:
venv/
├── cachetools
...
└── zipp-3.23.1.dist-info

to

  • uv plugin:
venv/
├── bin
│   └── activate
├── lib
│   └── python3.12
│       └── site-packages
│           ├── _yaml
...
│           └── yaml
└── pyvenv.cfg

which means the Environment=PYTHONPATH={{ CHARMDIR }}/venv no longer import the site-package correctly. The safest way is to use the python created by the venv.

Fixes: #551
Regression from: #530

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The updated ExecStart references {{ CHARMDIR }}/venv/python, which is unlikely to exist in a standard virtualenv and can prevent the service from starting.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adjusts the generated systemd unit template for the hardware exporter so it runs under the charm’s virtualenv correctly after the move to the uv plugin venv layout (fixing the “No module named prometheus_hardware_exporter” regression noted in #551 / #530).

Changes:

  • Removes the PYTHONPATH={{ CHARMDIR }}/venv approach from the systemd unit.
  • Updates ExecStart to run the exporter with the virtualenv activated.
File summaries
File Description
src/templates/hardware-exporter.service.j2 Updates systemd ExecStart strategy to ensure the exporter runs with the correct venv/site-packages layout.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/templates/hardware-exporter.service.j2 Outdated
@chanchiwai-ray

Copy link
Copy Markdown
Contributor Author

it's weird that this issue was not caught during the manual tests: #531

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is small and directly addresses the reported regression; the remaining feedback is a robustness/maintainability improvement rather than a functional blocker.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/templates/hardware-exporter.service.j2 Outdated
- charm plugin:

venv/
├── cachetools
...
└── zipp-3.23.1.dist-info

- uv plugin:

venv/
├── bin
│   └── activate
├── lib
│   └── python3.12
│       └── site-packages
│           ├── _yaml
...
│           └── yaml
└── pyvenv.cfg

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change directly addresses the reported regression by ensuring the service runs under the venv interpreter, and the template variables used are already supplied by the renderer.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@chanchiwai-ray

chanchiwai-ray commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Tested refresh behavior in eevee machine, result is passed

@chanchiwai-ray
chanchiwai-ray merged commit 10264b4 into main Sep 10, 2026
44 of 48 checks passed
@chanchiwai-ray
chanchiwai-ray deleted the regression/bug551 branch September 10, 2026 08:09
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.

No module named prometheus_hardware_exporter

4 participants