Rewrite our settings system

Registered by Rob Cresswell

Pain points:
- Misconfiguration by operators can cause the app to crash due to missing defaults
- Defining defaults manually duplicates code across the code base
- `openstack_dashboard/settings.py` is mutable (via local_settings) and cannot be relied upon to always have a default. For example, operator could override a dict, and forget to add a new key during an upgrade, which would break the app in unexpected ways.

We need a system that is organised logically, deprecates cleanly, and is flexible enough to support the requests of packagers and deployers. At the moment, we use a base 'settings.py' file that imports overrides from a 'local_settings.py' file and `local_settings.d` directory.

Suggestion:
- Move any defaults in `settings.py` to `defaults.py`. All defaults in the code import from this file. This prevents duplication across the code base if we change a default value and ensures a default is always available regardless of operator misconfiguration or upgrade changes.
- Update docs to encourage usage of `local_settings.d` instead of `local_settings.py`. This encourages a more modular architecture that plugins and distro's can also make use of. Long term we should probably remove the monolithic `local_settings.py file` anyway.

End result:
- settings.py will only carry the local_settings imports and potentially some small pieces of logic to be cleaned up later on.
- customisations are added as small modular pieces in local_settings.d, rather than 1000 line local_settings files.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Rob Cresswell
Direction:
Needs approval
Assignee:
Rob Cresswell
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Rob Cresswell

Related branches

Sprints

Whiteboard

[mrunge, 16-02-2016]
I would use oslo.config rather than stevedore, and I would try to keep .py files for *config* purposes as minimal as possible.

I like the idea to have something like defaults defined, but that can be kept in .ini files directly.

[r1chardj0n3s 2016-10-25]
Perhaps we could put a few .example files into local_settings.d (instead of local_settings.py.example), for example split out logging, themes, policy, ...?

[robcresswell 2016-10-26]
That makes sense, good idea

[robcresswell 2016-10-27]
From summit:
- We need to remove logic in settings.py and move to simple data structures like dicts and lists
- https://review.openstack.org/#/c/100521/ Radomir's patch to achieve similar things

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.