diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-11-10 10:23:30 -0600 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-11-10 17:35:44 -0600 |
commit | 75225b07acbda8dab8215a626088ba19739f73cb (patch) | |
tree | e0af09359b5b98c3775362b07f7a5a852c271d04 /src/lib/Bcfg2/Options | |
parent | 3d26097342ecbda755135dc3cf39517d75c027aa (diff) | |
download | bcfg2-75225b07acbda8dab8215a626088ba19739f73cb.tar.gz bcfg2-75225b07acbda8dab8215a626088ba19739f73cb.tar.bz2 bcfg2-75225b07acbda8dab8215a626088ba19739f73cb.zip |
Options: gather as much data from config file first
Diffstat (limited to 'src/lib/Bcfg2/Options')
-rw-r--r-- | src/lib/Bcfg2/Options/Parser.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Options/Parser.py b/src/lib/Bcfg2/Options/Parser.py index 6715d90f9..c846e8093 100644 --- a/src/lib/Bcfg2/Options/Parser.py +++ b/src/lib/Bcfg2/Options/Parser.py @@ -325,8 +325,16 @@ class Parser(argparse.ArgumentParser): # _parse_config_options is called, all config file options will get set # to their hardcoded defaults. This process defines the options in the # namespace and _parse_config_options will never look at them again. - self._set_defaults_from_config() - self._parse_config_options() + # + # we have to do the parsing in two loops: first, we squeeze as + # much data out of the config file as we can to ensure that + # all config file settings are read before we use any default + # values. then we can start looking at the command line. + while not self.parsed: + self.parsed = True + self._set_defaults_from_config() + self._parse_config_options() + self.parsed = False remaining = [] while not self.parsed: self.parsed = True |