Skip to content

fix: pass kubernetesPath into the mustache path context#302

Open
emmayusufu wants to merge 1 commit into
nodevault:masterfrom
emmayusufu:fix/kubernetes-path-mustache-context
Open

fix: pass kubernetesPath into the mustache path context#302
emmayusufu wants to merge 1 commit into
nodevault:masterfrom
emmayusufu:fix/kubernetes-path-mustache-context

Conversation

@emmayusufu
Copy link
Copy Markdown

Closes #300.

The kubernetes command paths use /auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login, so when no mount_point is passed they fall back to {{kubernetesPath}}. But kubernetesPath only exists on the client object (client.kubernetesPath, defaulted to 'kubernetes' in src/index.js) and was never added to the mustache render context, which only received the call args. So the fallback rendered empty and kubernetesLogin() hit /auth//login instead of /auth/kubernetes/login.

The fix injects client.kubernetesPath into the render context, with call args still taking precedence so a per-call override keeps working. This also covers the other kubernetes role command paths that use the same template.

Added two unit tests (default mount point, and a custom kubernetesPath). Both fail on the old code with /auth//login and pass with the fix. Full unit suite: 99 passing, lint clean.

The kubernetes command paths fall back to {{kubernetesPath}} when no
mount_point is given, but kubernetesPath only lives on the client and
was never added to the mustache render context, so the templates
rendered an empty segment (e.g. kubernetesLogin hit /auth//login
instead of /auth/kubernetes/login).

Inject client.kubernetesPath into the render context; per-call args
still take precedence. Adds unit tests for the default and a custom
kubernetesPath.

Closes nodevault#300
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.

Bug: kubernetesLogin uses {{kubernetesPath}} mustache variable but it's not passed, causing /auth//login path in v0.10.10

1 participant