fix: pass kubernetesPath into the mustache path context#302
Open
emmayusufu wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #300.
The kubernetes command paths use
/auth/{{mount_point}}{{^mount_point}}{{kubernetesPath}}{{/mount_point}}/login, so when nomount_pointis passed they fall back to{{kubernetesPath}}. ButkubernetesPathonly exists on the client object (client.kubernetesPath, defaulted to'kubernetes'insrc/index.js) and was never added to the mustache render context, which only received the callargs. So the fallback rendered empty andkubernetesLogin()hit/auth//logininstead of/auth/kubernetes/login.The fix injects
client.kubernetesPathinto 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//loginand pass with the fix. Full unit suite: 99 passing, lint clean.