Skip to content

etcdbackend: support version auto discovery#2299

Merged
jefferai merged 3 commits into
hashicorp:masterfrom
xiang90:auto_discovery
Jan 26, 2017
Merged

etcdbackend: support version auto discovery#2299
jefferai merged 3 commits into
hashicorp:masterfrom
xiang90:auto_discovery

Conversation

@xiang90
Copy link
Copy Markdown
Contributor

@xiang90 xiang90 commented Jan 24, 2017

Rule:

when api version is not defined by user:

  1. use api 2 if server only supports api 2
  2. use api 2 if previous vault data exists in api 2
  3. use api 3 if server supports api3 and no user data exists in api 2

when api version is provided by user, always trust user.

Manually tested.

@xiang90 xiang90 changed the title Auto discovery etcdbackend: support version auto discovery Jan 24, 2017
@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jan 24, 2017

@jefferai

Hi, i do not think the CI failure is relevant to this pr.

@jefferai
Copy link
Copy Markdown
Member

Is rule #2 because you're concerned about breakages with existing data if the API level changes?

@jefferai
Copy link
Copy Markdown
Member

Also, the failure is not related to this. I made a copypasta screwup when fixing tests because of a sad interaction between Go bugs and trusty on Travis. It should be fixed if you rebase on master.

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jan 24, 2017

Is rule #2 because you're concerned about breakages with existing data if the API level changes?

Yes, exactly.

Comment thread physical/etcd.go
}
}

func getEtcdAPIVersion(c client.Client) (string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comments on this function as to how the version is computed might be helpful.

Comment thread physical/etcd2.go Outdated
if haEnabled == "" {
haEnabled = conf["ha_enabled"]
}
haEnabledBool, _ := strconv.ParseBool(haEnabled)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we catch the error here?

@jefferai
Copy link
Copy Markdown
Member

Agreed on Vishal's request to catch the ParseBool error (people do put strange things in config file) but after that we'll merge it.

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jan 25, 2017

@jefferai I will clean up today or tomorrow, and ping you guys. Thanks a lot for reviewing it.

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jan 25, 2017

@jefferai @vishalnayak fixed. PTAL!

@jefferai
Copy link
Copy Markdown
Member

👍

@jefferai jefferai added this to the 0.6.5 milestone Jan 26, 2017
@jefferai jefferai merged commit 73ad5b7 into hashicorp:master Jan 26, 2017
@xiang90 xiang90 deleted the auto_discovery branch January 26, 2017 22:26
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.

3 participants