feat: add containerization detection to version endpoint
Added containerized and containerId fields to /api/version endpoint to enable automatic temperature proxy installation for LXC containers. Changes: - Added Containerized bool field to VersionResponse - Added ContainerId string field to VersionResponse - Detect containerization by checking /run/systemd/container file - Extract container ID from hostname for LXC containers - Set deployment type from container type (lxc/docker) This allows the PVE setup script to: 1. Detect that Pulse is running in a container 2. Find the container ID by matching IPs 3. Automatically install pulse-sensor-proxy on the host 4. Configure bind mount for secure socket communication Fixes the issue where setup script showed 'Proxy not available' even when Pulse was containerized.
This commit is contained in:
parent
d430efcecb
commit
8194ce9e7a
2 changed files with 18 additions and 0 deletions
|
|
@ -2264,6 +2264,22 @@ func (r *Router) handleVersion(w http.ResponseWriter, req *http.Request) {
|
|||
DeploymentType: versionInfo.DeploymentType,
|
||||
}
|
||||
|
||||
// Detect containerization (LXC/Docker)
|
||||
if containerType, err := os.ReadFile("/run/systemd/container"); err == nil {
|
||||
response.Containerized = true
|
||||
|
||||
// Try to get container ID from hostname (LXC containers often use CTID as hostname)
|
||||
if hostname, err := os.Hostname(); err == nil {
|
||||
// For LXC, try to extract numeric ID from hostname or use full hostname
|
||||
response.ContainerId = hostname
|
||||
}
|
||||
|
||||
// Add container type to deployment type if not already set
|
||||
if response.DeploymentType == "" {
|
||||
response.DeploymentType = string(containerType)
|
||||
}
|
||||
}
|
||||
|
||||
// Add cached update info if available
|
||||
if cachedUpdate := r.updateManager.GetCachedUpdateInfo(); cachedUpdate != nil {
|
||||
response.UpdateAvailable = cachedUpdate.Available
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ type VersionResponse struct {
|
|||
DeploymentType string `json:"deploymentType,omitempty"`
|
||||
UpdateAvailable bool `json:"updateAvailable"`
|
||||
LatestVersion string `json:"latestVersion,omitempty"`
|
||||
Containerized bool `json:"containerized"`
|
||||
ContainerId string `json:"containerId,omitempty"`
|
||||
}
|
||||
|
||||
// ErrorResponse represents an error response
|
||||
|
|
|
|||
Loading…
Reference in a new issue