Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version protocol switch #3833

Merged
merged 11 commits into from
Jan 23, 2018
Merged

Version protocol switch #3833

merged 11 commits into from
Jan 23, 2018

Conversation

calvn
Copy link
Contributor

@calvn calvn commented Jan 23, 2018

No description provided.

@calvn calvn requested a review from briankassouf January 23, 2018 19:10
@@ -70,6 +71,7 @@ func (r *PluginRunner) runCommon(ctx context.Context, wrapper RunnerUtil, plugin
if wrapper.MlockEnabled() {
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", PluginMlockEnabled, "true"))
}
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", PluginVaultVersionEnv, version.GetVersion().VersionNumber()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

version.GetVersion().VersionNumber() would return "(version unknown)" if if Version == "unknown" && VersionPrerelease == "unknown" is satisfied. The check on https://github.com/hashicorp/vault/pull/3833/files#diff-cedffd7b22c2dfe1ab831e6c9f38e45dR19 would need to be changed to check for that instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the "unknown" check below not sufficient?

Copy link
Contributor Author

@calvn calvn Jan 23, 2018

Choose a reason for hiding this comment

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

version.GetVersion().VersionNumber() would never return the string "unknown" (it returns "(version unknown)") so verString != "unknown" will always be true, even when the version is unknown.

return constraint.Check(ver)
}

return false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should default to using/supporting gRPC instead of the other way around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case if the version is unknown (e.g. from a master build that didn't inherit version from a git tag), it will end up will using netrpc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I see why you're doing this (to maintain backward compatibility in the case PluginVaultVersionEnv is not provided due to older versions of the plugin). Maybe if verString == "" should be its own check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately we can't because older versions of vault won't be setting the ENV variable. If the variable is empty we can't use gRPC

Copy link
Contributor Author

@calvn calvn Jan 23, 2018

Choose a reason for hiding this comment

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

Right so check for verString == "" early and short-circuit by returning false. We can then return true here and in the error cases.

true,
},
{
"",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shows up somewhat weird on the test output, wondering if it's worth adding a name field for this

=== RUN   TestGRPCSupport
=== RUN   TestGRPCSupport/0.8.3
=== RUN   TestGRPCSupport/0.9.2
=== RUN   TestGRPCSupport/0.9.2+ent
=== RUN   TestGRPCSupport/0.9.2-beta
=== RUN   TestGRPCSupport/unknown
=== RUN   TestGRPCSupport/#00
--- PASS: TestGRPCSupport (0.00s)
    --- PASS: TestGRPCSupport/0.8.3 (0.00s)
    --- PASS: TestGRPCSupport/0.9.2 (0.00s)
    --- PASS: TestGRPCSupport/0.9.2+ent (0.00s)
    --- PASS: TestGRPCSupport/0.9.2-beta (0.00s)
    --- PASS: TestGRPCSupport/unknown (0.00s)
    --- PASS: TestGRPCSupport/#00 (0.00s)
PASS
ok  	github.com/hashicorp/vault/helper/pluginutil	0.014s

Copy link
Contributor

@briankassouf briankassouf left a comment

Choose a reason for hiding this comment

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

LGTM

@calvn calvn merged commit c3c6331 into master Jan 23, 2018
@calvn calvn deleted the plugin-protocol-switch branch January 23, 2018 22:29
@calvn calvn added this to the 0.9.2 milestone Jan 24, 2018
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