Cloud pollers (is_cloud_poller = true, organization_id = nil) were
being blocked from polling devices because verify_device_organization
was checking if the device's organization matched the agent's
organization.
Since cloud pollers don't belong to any organization (organization_id
is nil), they should be allowed to poll devices from any organization.
Changes:
- verify_device_organization now allows access if organization_id is nil
- This fixes "Device not in agent's organization" errors for cloud pollers
Error before:
Device b7e8dd99-0b19-496d-97ae-9f2601d16464 not in agent's organization
Production was crashing with CaseClauseError when viewing device edit
form for devices using the global default cloud poller.
Added missing :global case branch to the agent source case statement
in form.html.heex line 127.
Displays: 'Using global default cloud poller: <agent_name>'
Two issues fixed:
1. Cloud pollers (organization_id = nil) were causing access denied errors
when superadmins tried to view them. Now allows access if user is
superadmin and agent is a cloud poller.
2. Ecto.NoResultsError was being raised without required :queryable option,
causing KeyError crash. Now properly raises with queryable parameter.
Error was:
KeyError: key :queryable not found in []
(ecto 3.13.5) lib/ecto/exceptions.ex:203: Ecto.NoResultsError.exception/1
(towerops) lib/towerops_web/live/agent_live/show.ex:16: mount/3
HTML checkboxes send value='on' when checked, not 'true'. Updated
parse_agent_params to accept both 'on' and 'true' values for the
is_cloud_poller field.
Added debug logging to help diagnose future form submission issues.
Added logging to identify which component is failing health checks:
- Log database and Redis status on each health check
- Log Redis errors with full error details
- This will help diagnose the production 503 errors