Commit a77f9c8
fix: unregister agent with sudo when config is in /root/.gpugo
Critical fix for agent unregistration during uninstall.
Problem:
When gpugo is installed with GPU_GO_TOKEN (agent mode), the install
script runs `sudo ggo agent register` which saves config to
/root/.gpugo/config/agent.yaml. During uninstall, the unregister
command was running as normal user and couldn't read root's config,
causing silent failure.
Changes:
1. Detect if agent config exists in root directories
- Check /root/.gpugo/config/agent.yaml
- Check /root/.config/ggo/agent.yaml
2. Run unregister with sudo if agent mode detected
- Properly construct command with sudo
- Handle sudo not available gracefully
3. Improved error handling
- Capture exit code correctly
- Show clear warnings if unregistration fails
- Inform user they may need manual cleanup on server
4. Better command execution
- Avoid word splitting issues with proper quoting
- Disable set -e for unregister command using || pattern
- Show exit code in warning message
This ensures agents are properly unregistered from the server before
removing local config files.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent f338cbc commit a77f9c8
1 file changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
264 | 287 | | |
265 | 288 | | |
266 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
267 | 292 | | |
268 | 293 | | |
269 | 294 | | |
| |||
0 commit comments