Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Options: Fixed non-path database name parsing | Chris St. Pierre | 2014-11-10 | 1 | -22/+41 |
| | | | | | | | | | | | | The database name is sometimes a path (SQLite) and sometimes not (MySQL, PostgreSQL). This introduces a new Option type, RepositoryMacroOption, that expands <repository> macros without canonicalizing the path, so SQLite users can use <repository> in their settings but MySQL users' database name settings will not be destroyed by path canonicalization. The unfortunate downside is that SQLite users can't use ~ in their database name. | ||||
* | Options: fix path canonicalization and file-like objects | Chris St. Pierre | 2014-11-10 | 1 | -8/+3 |
| | | | | | | This fixes canonicalizing PathOption values when the default value of a config file-only option is used. It also fixes PathOptions that get a file-like object instead of a filename string. | ||||
* | Options: ensure <repository> macros are always fixed up | Chris St. Pierre | 2014-11-10 | 1 | -17/+42 |
| | | | | | | | This fixes several cases in which <repository> macros would not be properly processed: options that are not added to the parser yet when early options are parsed; and config file options whose default value is used. | ||||
* | testsuite: better debug capturing for options tests | Chris St. Pierre | 2014-11-10 | 1 | -2/+6 |
| | |||||
* | testsuite: Added unit tests for new option parsing | Chris St. Pierre | 2014-11-10 | 1 | -25/+103 |
| | |||||
* | Use setdefault instead of a conditional | Michael Fenn | 2014-07-15 | 1 | -3/+1 |
| | |||||
* | Correctly handle config-file-only BooleanOptions which default to True | Michael Fenn | 2014-07-14 | 1 | -4/+25 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Bcfg2.Options.Parser._parse_config_options, if the "default" of the option (perhaps set by the config file) evaluates to True, then it runs the actions associated with the option. Otherwise, it just sets the option to the default directly with setattr. Since the default of a store_false action is True, the code will run argparse's _StoreFalseAction function. Well, _StoreFalseAction, is a subclass of _StoreConstAction where const=False. _StoreConstAction has a call method which looks like this: def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, self.const) So it completely ignores the value passed in and just sets the value of the option to const (i.e. False). Looking at fam_blocking {None: _StoreFalseAction(option_strings='fam_blocking', dest='fam_blocking', nargs=0, const=False, default=True, type=None, choices=None, help='FAM blocks on startup until all events are processed', metavar=None)} start phase 3 fam_blocking config val is True start phase 3 _parse_config_options: fam_blocking default is True _parse_config_options: calling argparse.<class 'argparse._StoreFalseAction'> with value True on fam_blocking _parse_config_options: after calling argparse.<class 'argparse._StoreFalseAction'> fam_blocking is False after _parse_config_options fam_blocking is False after phase 3 fam_blocking is False after phase 4 fam_blocking is False end of parser fam_blocking is False CLI init fam_blocking is False So how to fix it? Define a new Action? That seems like the most direct approach since the problem really is that _StoreFalseAction does what it says on the tin, it stores false no matter what. The new action BooleanOptionAction works like store_true and store_false, except that it stores the value that was passed in, or the default if there was no value passed in. | ||||
* | pep8 fixes | Michael Fenn | 2014-04-09 | 1 | -1/+0 |
| | |||||
* | Options: Finalize actual value, not default value | Chris St. Pierre | 2014-03-05 | 1 | -14/+18 |
| | | | | This also fixes some extraneous calls in the option parsing loop. | ||||
* | Options: set options debugging with environment variable | Chris St. Pierre | 2014-03-05 | 1 | -2/+24 |
| | |||||
* | Options: Replace relative imports with absolute | Chris St. Pierre | 2013-08-12 | 1 | -1/+1 |
| | |||||
* | testsuite: fixed most pylint complaints | Chris St. Pierre | 2013-08-09 | 1 | -3/+7 |
| | |||||
* | Options: fix parsing of ComponentActions and other finalizable actions | Chris St. Pierre | 2013-08-09 | 1 | -4/+3 |
| | |||||
* | Options: wrote completely new option parser | Chris St. Pierre | 2013-06-27 | 1 | -0/+305 |