On 02/12/2013 06:34 PM, James Antill wrote:
Trying to be much shorter, the problem that two objects solves is that
you have API users which look like:
yb = YumBase()
yb.preconf.installroot = "/myinstallroot"
print yb.conf.whatever
...so you need a way to set a subset of the available configuration
before the "rest" of the configuration is loaded.
Ah, that's true. The DNF approach approach towards the API users is:
- if it's something that is essential for how the config loading
(logging, root override) happens, make sure to specify it before the
given action takes place
- read_conf_file() is what loads the conf file configuration, it just
puts the loaded values directly into the conf object.
- if the api user doesn't like that read_conf_file() overrides some of
his previous configuration he can change it back later. This is
inconvenient, but makes read_conf_file()'s semantics very simple and
transparent.
- there is still some magic involved (as from cli e.g we don't want the
first step of reading the conf file to reset e.g. the root that was
given on the command line), for now this is why read_conf_file() accepts
an overrides dictionary. But it still could be made simpler for the
outside world, e.g. by having smart attributes (descriptors) that
remember they were manually set from the default value and shouldn't be
overridden by the configuration file).
Ales
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel