Skip to content

bug: Make 3.3.0 compatible with netbox-docker-agent >= 1.25 - #248

Merged
fanshan merged 6 commits into
main_v3from
compat/agent-1.25
Sep 18, 2026
Merged

fanshan merged 6 commits into
main_v3from
compat/agent-1.25

Conversation

@fanshan

@fanshan fanshan commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

The agent writes container state back to NetBox using values read verbatim from the Docker daemon. Four of those values were rejected by the 3.3.0 models, which made every refresh and import fail with HTTP 400.

  • log_driver: the choice set only allowed json-log (not a real Docker driver name) and syslog, while the agent sends HostConfig.LogConfig.Type, i.e. json-file on a default daemon. The field is now free-form and nullable, and existing json-log rows are normalised to json-file.
  • public_port: the agent uses -1 for exposed but unpublished ports; the validator floor moves from 0 to -1.
  • cap_add: the enumeration only contained NET_ADMIN, while the agent reports the container's real capabilities with the CAP_ prefix stripped. The full Linux capability set is now accepted.
  • Env.value: raised from 4096 to 32768 characters, since the agent imports environment values verbatim.

All changes are widening only: no existing data becomes invalid, and nothing here depends on a NetBox API newer than 4.1.

Feature parity with the 5.x line (cmd, sysctls, cap_drop, pid_mode, extra_hosts, secOpt, pause/unpause) is deliberately out of scope.

Vincent and others added 3 commits September 18, 2026 17:15
The agent writes container state back to NetBox using values read verbatim
from the Docker daemon. Four of those values were rejected by the 3.3.0
models, which made every refresh and import fail with HTTP 400.

- log_driver: the choice set only allowed `json-log` (not a real Docker
  driver name) and `syslog`, while the agent sends HostConfig.LogConfig.Type,
  i.e. `json-file` on a default daemon. The field is now free-form and
  nullable, and existing `json-log` rows are normalised to `json-file`.
- public_port: the agent uses -1 for exposed but unpublished ports; the
  validator floor moves from 0 to -1.
- cap_add: the enumeration only contained NET_ADMIN, while the agent reports
  the container's real capabilities with the CAP_ prefix stripped. The full
  Linux capability set is now accepted.
- Env.value: raised from 4096 to 32768 characters, since the agent imports
  environment values verbatim.

All changes are widening only: no existing data becomes invalid, and nothing
here depends on a NetBox API newer than 4.1.

Feature parity with the 5.x line (cmd, sysctls, cap_drop, pid_mode,
extra_hosts, secOpt, pause/unpause) is deliberately out of scope.
`0038_alter_port_public_port` clashed with main's `0038_container_cmd`:
both depended on `0037_alter_env_value`, so the two branches carried
diverging migration graphs. Upgrading a NetBox instance from this branch
to a main release left an orphan row in `django_migrations`, and merging
the branches gave Django two leaf nodes, which it refuses to load.

Backport `0038_container_cmd` and its `Container.cmd` field from main,
then renumber the port migration to `1039_alter_port_public_port` with
`0038_container_cmd` as its dependency. The migration graph of this
branch is now a strict prefix of main's.

`Container.cmd` is deliberately left out of the serializers, forms, tables
and filtersets here: it exists only to keep the model state and the
database schema in sync with main, without backporting the feature itself.
@fanshan
fanshan requested a review from lvenier September 18, 2026 16:36
@fanshan fanshan self-assigned this Sep 18, 2026
psycopg-c 3.2.3 fails to build against the PostgreSQL 18 headers now
shipped by the GitHub runners: PostgreSQL 18 dropped the HAVE_LONG_INT_64
macro that the vendored numutils.c relies on.

Swap the `c` extra for `binary` before installing the requirements, so the
extension is never compiled. The binary wheel bundles its own libpq and is
equivalent for running the test suite.
@github-actions

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2614 2566 98% 90% ✅

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 5ed2891 by action🐍

@fanshan
fanshan merged commit 197fa31 into main_v3 Sep 18, 2026
1 check passed
@fanshan
fanshan deleted the compat/agent-1.25 branch September 18, 2026 17:01
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.

2 participants