summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #292 from AlexanderS/fix-options-defaultChris St. Pierre2015-07-281-0/+3
|\ | | | | Options: Set default values from config, right after adding a new option
| * Options: Set default values from config, right after adding a new optionAlexander Sulfrian2015-07-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If adding an option during the "Main Parser Loop" (for example because of loading a component for bcfg-lint) a value for the option from the config file is simply ignored. After adding the option, the parser first tries to find the value in the command line, but cannot find it and set the default value from the source code as option value. After that the value from the config file is set as new default, but because the option already is in the Namespace, it does not use the new "default" value from the config file. This patch simply sets the default value from the config file for the new options, right after adding it to the parser and so the correct value is used afterwards, if the parser cannot find the flag on the command line.
* | Options/Types: Fix database OPTIONS parsingAlexander Sulfrian2015-07-231-22/+5
|/ | | | | | | | This is mostly from 257eb0c17 and 16d3e04cb to allow for setting arbitrary database options since some settings require nested dictionaries, etc. This got lost during merge from maint into master because of the completely different Options parsing.
* Bcfg2/Options/Parser: fix --version option, add testAlexander Sulfrian2014-11-251-2/+9
|
* Merge pull request #233 from AlexanderS/fix-list-optionsChris St. Pierre2014-11-111-0/+4
|\ | | | | Options/Types: add abbility to set empty lists
| * Options/Types: add abbility to set empty listsAlexander Sulfrian2014-10-311-0/+4
| | | | | | | | | | | | We have some lists with default values, so someone maybe want to set an empty list from the config. Previously this was not possible, because an empty string results in a list with an empty string as element. This fixes this problem.
* | Options: Fixed non-path database name parsingChris St. Pierre2014-11-101-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: gather as much data from config file firstChris St. Pierre2014-11-101-2/+10
| |
* | Options: fix path canonicalization and file-like objectsChris St. Pierre2014-11-101-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 upChris St. Pierre2014-11-102-40/+96
| | | | | | | | | | | | | | 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 testsChris St. Pierre2014-11-101-2/+6
| |
* | fixed some places where plugin loading should fail silentlyChris St. Pierre2014-11-101-2/+6
| |
* | testsuite: skip nested exclusive option group test on py2.6Chris St. Pierre2014-11-101-2/+2
| |
* | testsuite: Added unit tests for new option parsingChris St. Pierre2014-11-106-167/+291
|/
* Options: change default communication protocol to xmlrpc/tlsv1Alexander Sulfrian2014-10-151-1/+1
|
* Options: add missing communication:protocol optionsAlexander Sulfrian2014-10-151-0/+6
| | | | | The option was there in bcfg2-1.3.x and is still documented (maybe it just got lost during the options rewrite).
* Options/Common: remove defaults for ssl-key/ssl-cert on the ClientAlexander Sulfrian2014-10-141-10/+0
| | | | | | | With these default values it is impossible to remove the ssl key and ssl cert from the configuration and use password auth. Configuration options could not be condensed in Bcfg2.Options.Common, because Server and Client needs different default values.
* Options: Fix default "Log to syslog" valueSol Jerome2014-07-311-1/+1
| | | | | | | This changes makes the default value match what is specified by the documentation. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
* Use setdefault instead of a conditionalMichael Fenn2014-07-151-3/+1
|
* Correctly handle config-file-only BooleanOptions which default to TrueMichael Fenn2014-07-141-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.
* Merge branch 'master-test-fixes' of https://github.com/fennm/bcfg2Sol Jerome2014-04-141-1/+0
|\
| * pep8 fixesMichael Fenn2014-04-091-1/+0
| |
* | don't trigger full reparse on adding config fileMichael Fenn2014-04-141-1/+1
| | | | | | | | | | | | The full reparse turns out to be unnecessary with one change to the server options, and plays havoc with ordering of django components and overriding values in bcfg2-web.conf
* | Add BCFG2_CONFIG_FILE environment variable (regression from 1.3)Michael Fenn2014-04-071-0/+2
|/
* Options: call _set_defaults_from_config before _parse_config_optionsMichael Fenn2014-03-191-0/+18
| | | | | | | | | | | | | | | | | | | | _set_defaults_from_config must be called before _parse_config_options This is due to a tricky interaction between the two methods: (1) _set_defaults_from_config does what its name implies, it updates the "default" property of each Option based on the value that exists in the config. (2) _parse_config_options will look at each option and set it to the default value that is _currently_ defined. If the option does not exist in the namespace, it will be added. The method carefully avoids overwriting the value of an option that is already defined in the namespace. Thus, if _set_defaults_from_config has not been called yet when _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.
* Options: rename _set_defaults to _set_defaults_from_configMichael Fenn2014-03-191-3/+3
| | | | This is to make the method name more in line with what it does
* Options: set config file options only for the running parserChris St. Pierre2014-03-141-5/+4
|
* Options: finalize ConfigFileActionsChris St. Pierre2014-03-051-15/+27
| | | | | This ensures that /etc/bcfg2-web.conf gets read, even if the --web-config for [reporting].config options are not given
* Options: Finalize actual value, not default valueChris St. Pierre2014-03-053-17/+21
| | | | This also fixes some extraneous calls in the option parsing loop.
* Options: set options debugging with environment variableChris St. Pierre2014-03-052-4/+48
|
* Options: fail_silently really fails silently when loading componentsChris St. Pierre2014-03-051-1/+1
|
* Merge branch 'maint'Chris St. Pierre2013-12-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/appendix/guides/fedora.txt misc/bcfg2.spec schemas/types.xsd src/lib/Bcfg2/Encryption.py src/lib/Bcfg2/Options.py src/lib/Bcfg2/Server/Admin/Client.py src/lib/Bcfg2/Server/Core.py src/lib/Bcfg2/Server/Lint/Validate.py src/lib/Bcfg2/Server/Plugin/helpers.py src/lib/Bcfg2/Server/Plugins/Bundler.py src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py src/lib/Bcfg2/Server/Plugins/Probes.py src/sbin/bcfg2-crypt testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedGenerator.py testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py testsuite/common.py testsuite/install.sh
* Options: Finalize onceMichael Fenn2013-12-071-1/+1
| | | | | | | | If finalize is called early, then some options will not be parsed but instead always take the default value (observed with reporting.transport). Calling finalize once at the end of the processing lets all options take the values they were assigned in the config file.
* Options: parse config options before setting defaultsChris St. Pierre2013-11-121-0/+1
|
* Options: made unit test flag publicChris St. Pierre2013-11-121-3/+3
|
* Options: added workaround for unit tests that use the parserChris St. Pierre2013-11-121-13/+12
|
* Options: Don't reparse initial config fileChris St. Pierre2013-10-311-3/+5
| | | | It hasn't been parsed at this stage anyway.
* DB: fixed how Django settings are loadedChris St. Pierre2013-10-301-8/+33
|
* Options: parse arg list passed in, not sys.argvChris St. Pierre2013-09-031-1/+1
|
* Options: fixed error message when bcfg2.conf is not readableChris St. Pierre2013-08-161-2/+1
|
* testsuite: exempt wildcard imports in Bcfg2.Options from pylintChris St. Pierre2013-08-121-1/+1
|
* Options: Replace relative imports with absoluteChris St. Pierre2013-08-127-23/+19
|
* testsuite: fixed more unit testsChris St. Pierre2013-08-121-1/+3
|
* testsuite: fixed unit testsChris St. Pierre2013-08-121-3/+3
|
* testsuite: fixed more unit testsChris St. Pierre2013-08-123-19/+18
|
* testsuite: fixed most pylint complaintsChris St. Pierre2013-08-096-17/+30
|
* Options: reparse all arguments on each passChris St. Pierre2013-08-091-7/+3
| | | | | | | | | This ensures that required positional arguments are handled properly. If we only reparse the remaining arguments -- i.e., those that were not understood on previous passes -- then we may parse out all of the positional arguments on the first pass, and then on a subsequent pass parse_known_args() will fail because the positional argument is not provided.
* Options: Fixed prefix in WildcardSectionGroupsChris St. Pierre2013-08-091-1/+1
|
* Options: fix parsing of ComponentActions and other finalizable actionsChris St. Pierre2013-08-093-9/+8
|
* Merge branch 'options-rewrite'Chris St. Pierre2013-08-082-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/lib/Bcfg2/Client/Frame.py src/lib/Bcfg2/Options.py src/lib/Bcfg2/Server/Admin/Init.py src/lib/Bcfg2/Server/Admin/Xcmd.py src/lib/Bcfg2/Server/BuiltinCore.py src/lib/Bcfg2/Server/Core.py src/lib/Bcfg2/Server/MultiprocessingCore.py src/lib/Bcfg2/Server/Plugin/base.py src/lib/Bcfg2/Server/Plugin/helpers.py src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py src/lib/Bcfg2/Server/Plugins/Packages/Yum.py src/lib/Bcfg2/Server/Plugins/Packages/__init__.py src/lib/Bcfg2/Server/SSLServer.py src/lib/Bcfg2/Utils.py src/lib/Bcfg2/settings.py src/sbin/bcfg2-crypt src/sbin/bcfg2-info src/sbin/bcfg2-lint src/sbin/bcfg2-test src/sbin/bcfg2-yum-helper tools/bcfg2-profile-templates.py