Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
state: pass in mgo.Session when opening State #8056
Conversation
| @@ -15,7 +17,7 @@ import ( | ||
| // controller addresses and the CA public certificate. | ||
| type AddressAndCertGetter interface { |
axw
Nov 14, 2017
Member
I've renamed it, although the types in this file aren't very well scoped anyway. CA certs have bugger all to do with addresses, and what's the ModelUUID doing in there? Anyway.
| @@ -492,8 +493,8 @@ func (m *mockState) APIHostPorts() ([][]network.HostPort, error) { | ||
| }, nil | ||
| } | ||
| -func (m *mockState) CACert() string { | ||
| - return testing.CACert | ||
| +func (m *mockState) ControllerConfig() (controller.Config, error) { |
axw
Nov 14, 2017
Member
It was used for the backend of the APIAddresser. I've updated the PR with a commit to remove CACert from that interface.
| + } | ||
| + caCert, ok := controllerConfig.CACert() | ||
| + if !ok { | ||
| + return nil, errors.New("CA certificate missing from controller config") |
wallyworld
Nov 13, 2017
Owner
Let's define NoCACertErr or something instead of the same string in several places.
Perhaps CACert() method itself on controllerConfig should return an error?
axw
Nov 14, 2017
Member
Ideally it would return neither a bool nor an error, since it's not possible to have controller config without a CA certificate past bootstrap. I'm ignoring the bool now, will add a card to change the controller.Config method.
| @@ -79,6 +79,7 @@ func newAPIHandler(srv *Server, st *state.State, rpcConn *rpc.Conn, modelUUID st | ||
| modelUUID: modelUUID, | ||
| serverHost: serverHost, | ||
| } | ||
| + |
axw
Nov 14, 2017
Member
need what? whitespace? accidentally snuck in as I added a resource, then removed it again - reverted
| - MongoInfo *mongo.MongoInfo | ||
| + // MongoSession is the mgo.Session to use for storing and | ||
| + // accessing state data. The caller remains responsible | ||
| + // for closing the session. |
wallyworld
Nov 13, 2017
Owner
for closing this session ??
(to distinguish from the copy that is made)
| - MongoDialOpts mongo.DialOpts | ||
| + // MongoSession is the mgo.Session to use for storing and | ||
| + // accessing state data. The caller remains responsible | ||
| + // for closing the session; Open will copy it. |
wallyworld
Nov 13, 2017
Owner
s/the/the passed in session?
Not sure if that clarification is needed? Makes sense to make the change to me anyway. YMMV
| + } `bson:"authenticatedUsers"` | ||
| + } `bson:"authInfo"` | ||
| + } | ||
| + if err := st.session.DB(jujuDB).Run(bson.D{{"connectionStatus", 1}}, &connectionStatus); err != nil { |
axw
added some commits
Nov 12, 2017
|
$$merge$$ |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
|
Build failed: it's a mystery |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
|
$$merge$$ |
axw commentedNov 13, 2017
Description of change
QA steps
Smoke test: bootstrap, destroy.
Documentation changes
None.
Bug reference
None.