Merge lp:~radix/landscape-client/fix-landscape-client-startup into lp:~landscape/landscape-client/trunk
Proposed by
Christopher Armstrong
Status: | Merged |
---|---|
Approved by: | Christopher Armstrong |
Approved revision: | 677 |
Merged at revision: | 678 |
Proposed branch: | lp:~radix/landscape-client/fix-landscape-client-startup |
Merge into: | lp:~landscape/landscape-client/trunk |
Diff against target: |
97 lines (+16/-35) 3 files modified
landscape/amp.py (+0/-26) landscape/broker/amp.py (+13/-6) landscape/broker/server.py (+3/-3) |
To merge this branch: | bzr merge lp:~radix/landscape-client/fix-landscape-client-startup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Donato (community) | Approve | ||
Free Ekanayaka (community) | Approve | ||
Review via email: mp+164045@code.launchpad.net |
Commit message
Get rid of implicit population of the components registry; it's now explicitly created in a function, and used directly when it's needed.
Description of the change
Unfortunately no tests with this one, but it's an almost-pure code refactor.
Basically, the module that happened to populate the global registry of components wasn't being imported any more. I decided to get rid of the global registry entirely as a solution :) now there's just a function that returns the registry (as a dict) when called. now there's no more dependency on import ordering.
To post a comment you must log in.
Looks good! +1
[1]
+ registry( ): nector, nector, nnector, nnector
+def get_component_
+ return {
+ "broker": RemoteBrokerCon
+ "client": RemoteClientCon
+ "monitor": RemoteMonitorCo
+ "manager": RemoteManagerCo
+ }
You could use the "name" class attribute of the "component" class attribute, to avoid duplication, e.g.:
return { rConnector. component. name: RemoteBrokerCon nector,
RemoteBroke
// etc.
}
Later on I believe we could get rid of the ComponentConnector sub-classes too relatively easy (as you did for the ComponentPublis her-based ones), but it'd probably require dropping the RemoteBroker class as pre-requisite. Its two methods could be moved to the Monitor/Manager classes where they are used (just thinking loud).
[2]
+ from landscape. broker. amp import get_component_ registry _registry = get_component_ registry( )
+ self.connectors
I believe one reason for which we had the ComponentRegistry was to avoid circular imports like this. So it'd be great to have a way of avoiding dependency on import ordering while still not introducing circular imports (maybe dropping the ComponentConnector sub-classes will do it, not sure).