Skip to content

fix(scripts): surface the NetBox plugin credential in quickstart output - #590

Merged
leoparente merged 4 commits into
developfrom
fix/quickstart-surface-plugin-credentials
Sep 3, 2026
Merged

fix(scripts): surface the NetBox plugin credential in quickstart output#590
leoparente merged 4 commits into
developfrom
fix/quickstart-surface-plugin-credentials

Conversation

@leoparente

Copy link
Copy Markdown
Contributor

Closes #414.

Problem

Both quickstart scripts create a netbox-to-diode OAuth2 client, but only ever print the diode-ingest one:

Configure orb-agent with diode target ... to use the following credentials:
  DIODE_CLIENT_ID:     diode-ingest
  DIODE_CLIENT_SECRET: <ingest secret>

That's correctly labelled for orb-agent, but it's the only secret the user is handed — so it's the one they paste into the plugin's configuration.py, where it cannot work. The plugin authenticates as netbox-to-diode.

GET_STARTED.md:53 already documents the correct jq command. But people follow the script's output rather than re-reading the guide: in #414 a reporter rediscovered that exact command and posted it as a workaround, and it resolved the problem for another reporter in the same thread.

#414 has six independent reporters over three months, mostly helping each other. It's the most common onboarding failure in the tracker.

Change

Both quickstarts now print both credentials, each labelled with what it configures, and name the client the plugin secret belongs to:

Configure orb-agent with diode target grpc://localhost:8080/diode to use the following credentials:
  DIODE_CLIENT_ID:     diode-ingest
  DIODE_CLIENT_SECRET: INGEST-SECRET-aaa

Configure the NetBox Diode plugin in configuration.py with:
  netbox_to_diode_client_secret: NETBOX-TO-DIODE-SECRET-bbb
  diode_target_override:         grpc://localhost:8080/diode
That is the netbox-to-diode client secret, not the ingest one above.

The helm quickstart had the same gap — it creates the client at line 87 and never surfaced it.

netbox_to_diode_client_id is deliberately not printed as a setting to add: it already defaults to "netbox-to-diode" in the plugin (netbox_diode_plugin/__init__.py:33), so listing it would invite people to set something they don't need. The client name appears only as context for which secret they're holding.

Docs: added a note that diode_target_override must be reachable from inside NetBox. Three reporters in #414 independently worked out that localhost resolves to the NetBox container rather than the Diode server when NetBox is containerised. Applied to both GET_STARTED.md and docs/getting-started.md.

Verification

Ran the credential-selection logic against a representative client-credentials.json with all three clients; each label picks the right secret. bash -n clean on both scripts. shellcheck -S warning reports 3 findings, all pre-existing in the secret-generation block — identical count on develop.

Not addressed here

#414 also collected two deployment-specific causes: an nginx container not binding 8080, and (in the last comment) the helm case where the target must go through the ingress. The latter is the same problem as #456 and was documented in #584.

🤖 Generated with Claude Code

Both quickstart scripts create a netbox-to-diode OAuth2 client but only
ever printed the diode-ingest one, labelled for orb-agent. That is the
only secret a user is handed, so it is the one they paste into the plugin's
configuration.py, where it cannot work: the plugin authenticates as
netbox-to-diode. The result is

  Failed to obtain access token: ... Connection refused

or an auth failure, with nothing pointing at the credential being for a
different client.

GET_STARTED.md already documents the correct jq incantation, but users
follow the script's output rather than re-reading the guide. In #414 one
reporter rediscovered that exact command and posted it as a workaround; it
resolved the issue for another reporter in the same thread.

Print both credentials, each labelled with what it configures, and name the
client the plugin secret belongs to. netbox_to_diode_client_id is not
printed as a setting to add: it already defaults to "netbox-to-diode" in
the plugin.

Also document that diode_target_override must be reachable from inside
NetBox. Three reporters in #414 independently worked out that localhost
resolves to the NetBox container rather than the Diode server when NetBox
is containerised.

Closes #414

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T17:51:51.787049Z 326d991 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This PR changes charts/diode/scripts/quickstart.sh, so ct lint requires a
chart version bump. 1.15.3 is already released as helm-chart-diode-1.15.3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref 6182a0ef6887726eafe227cea24a0d2fa0d1c6cd does not exist
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e6cbac4e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread charts/diode/scripts/quickstart.sh Outdated
The helm quickstart regenerates client-credentials.json whenever the local
file is absent (line 110), but skips creating the oauth2 Secret when it
already exists in the namespace (line 185). Re-running against an existing
namespace from a fresh working directory therefore produces local
credentials that were never applied to the cluster.

Printing the netbox-to-diode secret from that local file would hand out a
credential that cannot authenticate, which is the exact failure this PR
exists to prevent.

Read it from the deployed Secret instead, falling back to the local file
when the Secret is absent, unreadable, or does not contain the client. On a
first run the Secret does not exist yet and the local file is what will be
applied, so the fallback is correct there.

Caught in review by Codex on #590.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38b3345c83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread diode-server/docker/scripts/quickstart.sh Outdated
Comment thread diode-server/docker/scripts/quickstart.sh Outdated
Two problems with the plugin block printed at the end of both quickstarts.

It was emitted as `key: value`, which is not valid Python. Users are told
to put it in configuration.py, where the setting names and string values
must be quoted, and generated secrets end in `=` so an unquoted value is a
syntax error. Now emits quoted dictionary entries that paste directly into
PLUGINS_CONFIG["netbox_diode_plugin"].

The docker quickstart also advertised grpc://localhost:PORT/diode as the
target to configure. That address is reused from the orb-agent hint, where
it is usually right, but for the plugin it only works when NetBox runs
directly on this host outside a container. The getting-started guide
explicitly supports NetBox on a separate host, and the previous warning
mentioned only the containerised case. Now prints a <diode-host>
placeholder with a note covering both.

Verified by parsing the emitted lines: they exec as valid Python inside a
PLUGINS_CONFIG dict, the secret round-trips intact including its trailing
'=', and the target contains no localhost.

Caught in review by Codex on #590.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 326d991b1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@leoparente
leoparente merged commit fc40a26 into develop Sep 3, 2026
8 checks passed
@leoparente
leoparente deleted the fix/quickstart-surface-plugin-credentials branch September 3, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diode-chart diode-server documentation Improvements or additions to documentation markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to Obtain Access Token

2 participants