diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-03-14 09:57:35 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-03-14 09:57:35 -0400 |
commit | 8b1d8d83ef6afd408c8d3777f52111919cb31253 (patch) | |
tree | 286c03796d97d9657a2b88726f128190d01537c3 /src/lib/Bcfg2/Options/Parser.py | |
parent | 560a262b731b53bc99a42eef8e17b16cc9630107 (diff) | |
download | bcfg2-8b1d8d83ef6afd408c8d3777f52111919cb31253.tar.gz bcfg2-8b1d8d83ef6afd408c8d3777f52111919cb31253.tar.bz2 bcfg2-8b1d8d83ef6afd408c8d3777f52111919cb31253.zip |
Options: set config file options only for the running parser
Diffstat (limited to 'src/lib/Bcfg2/Options/Parser.py')
-rw-r--r-- | src/lib/Bcfg2/Options/Parser.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Options/Parser.py b/src/lib/Bcfg2/Options/Parser.py index d855b6232..f05205143 100644 --- a/src/lib/Bcfg2/Options/Parser.py +++ b/src/lib/Bcfg2/Options/Parser.py @@ -145,13 +145,10 @@ class Parser(argparse.ArgumentParser): if not opt.args and opt.dest not in self.namespace: value = opt.default if value: - for parser, action in opt.actions.items(): + for _, action in opt.actions.items(): _debug("Setting config file-only option %s to %s" % (opt, value)) - if parser is None: - action(self, self.namespace, value) - else: - action(parser, parser.namespace, value) + action(self, self.namespace, value) else: setattr(self.namespace, opt.dest, value) @@ -246,8 +243,10 @@ class Parser(argparse.ArgumentParser): early_components.append(component) early_parser.add_component(component) early_parser.parse(self.argv) + _debug("Early parsing complete, calling hooks") for component in early_components: if hasattr(component, "component_parsed_hook"): + _debug("Calling component_parsed_hook on %s" % component) getattr(component, "component_parsed_hook")(early_opts) # phase 3: re-parse command line, loading additional |