Skip to content

Commit

Permalink
Fix NewVersionError() for clients using default version
Browse files Browse the repository at this point in the history
The NewVersionError checks if the client is using the API version
required for using a specific feature.

If the client is initialized without setting a specific version, an
error would be generated because it was not possible to compare
versions. However, a client without explicit version set is running
the latest supported version.

This patch changes the behavior to only generate an error if a version
was set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 30, 2017
1 parent 82390eb commit ff2ed18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func IsErrPluginPermissionDenied(err error) bool {
// NewVersionError returns an error if the APIVersion required
// if less than the current supported version
func (cli *Client) NewVersionError(APIrequired, feature string) error {
if versions.LessThan(cli.version, APIrequired) {
if cli.version != "" && versions.LessThan(cli.version, APIrequired) {
return fmt.Errorf("%q requires API version %s, but the Docker daemon API version is %s", feature, APIrequired, cli.version)
}
return nil
Expand Down

0 comments on commit ff2ed18

Please sign in to comment.