Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
New upgrade step to rename addmodel permission #6435
Conversation
| + var doc bson.M | ||
| + for iter.Next(&doc) { | ||
| + fieldVal, ok := doc["access"] | ||
| + if !ok || fieldVal != "addmodel" { |
mjs
Oct 12, 2016
Contributor
You could avoid this and make the set of documents shorter by querying for permissions which use addmodel.
| + return errors.New("no id found in permission doc") | ||
| + } | ||
| + | ||
| + update := bson.DocElem{"$set", bson.D{{"access", "add-model"}}} |
mjs
Oct 12, 2016
•
Contributor
Why not bson.D{{""$set", bson.D{{"access", "add-model"}}}}? It's shorter and saves having to wrap the bson.D later.
Also, there's no need to define this in the loop. Given the update is always the same, just define it above.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit 52b1091
into
juju:master
Oct 12, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wallyworld commentedOct 12, 2016
addmodel permission was recently renamed to add-model.
This PR adds upgrade steps to convert any existing values.
QA: bootstrap older juju. Add addmodel permission to a user. upgrade. Check permission updated.