summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-11-10 10:23:30 -0600
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-11-10 10:23:30 -0600
commit9e5d720a54b51b606a7a4b6f0a1efd5905e5d2a3 (patch)
tree4ea40c94c1d9364b6b426f536d56d41f5b18bda2
parentbb21c79f38c155fb14289479840efd8abdf54689 (diff)
downloadbcfg2-9e5d720a54b51b606a7a4b6f0a1efd5905e5d2a3.tar.gz
bcfg2-9e5d720a54b51b606a7a4b6f0a1efd5905e5d2a3.tar.bz2
bcfg2-9e5d720a54b51b606a7a4b6f0a1efd5905e5d2a3.zip
Options: gather as much data from config file first
-rw-r--r--src/lib/Bcfg2/Options/Parser.py12
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