ogagent/pipeline/head This commit looks goodDetails
On machines with multiple NICs, the agent was always registering with
ogcore using the first interface returned by the OS, which could be the
wrong one if it wasn't the interface with a route to ogcore.
_best_interface() opens a no-op UDP socket toward the ogcore host and
reads the local IP assigned by the kernel routing table, then matches it
against the available interfaces. If the routing query fails (network not
ready yet) it returns None so the detection loop keeps retrying rather
than accepting a wrong interface. Falls back to nets[0] only when the
query succeeds but no interface matches (NAT/VPN scenario).
Add 'busy' and 'st' fields to the periodic webhook ping so ogCore can
track whether a client is executing a job without waiting for a command
response.
- oglive_worker: busy derived from thread_list running state, st='OGL'
- OpenGnSys module: busy derived from jobmgr active processes, st mapped
from operations.os_type (LNX/WIN/OSX)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
POST requests without a body (e.g. Reiniciar, Apagar) caused
json.loads("") to raise JSONDecodeError, which sent a 500 response
but continued executing the handler, resulting in a double response.
The client received 500 while the handler actually succeeded.
- Handle missing or zero Content-Length without attempting JSON parse
- Add return after sendJsonError to prevent calling notifyMessage after
an error response has already been sent
- Track registration state with _registered flag; monitoring thread
re-sends ogagent/started when contact with ogcore is restored
- Fix AttributeError in REST client when a network-level error
(timeout, connection refused) occurred: e.response is None for
non-HTTP failures, so guard before accessing .status_code
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ogagent/pipeline/head This commit looks goodDetails
## Summary
- Write the authentication token to `/tmp/ogagent.token` on oglive startup so local scripts can authenticate against the agent without needing to know the token in advance.
- Remove token file writing from OS/Windows mode (`OpenGnSys` module), where it was being written to `/opt/opengnsys/etc/ogagent.token`. The token file is now exclusive to oglive mode.
## Test plan
- [ ] Boot a machine into oglive and verify `/tmp/ogagent.token` is created with a 32-character alphanumeric token
- [ ] Verify a local script can read the token and use it to authenticate against the agent REST API
- [ ] Boot a machine into a normal OS (Windows/Linux) and verify `/opt/opengnsys/etc/ogagent.token` is **not** created
- [ ] Verify normal agent operation is not affected in OS mode (connection to ogcore, script execution, etc.)
Co-authored-by: Nicolas Arenas <nicolas.arenas@qindel.com>
Reviewed-on: #70