| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Options: Set default values from config, right after adding a new option
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| | |
Options/Types: add abbility to set empty lists
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
|
|
|
|
| |
The option was there in bcfg2-1.3.x and is still documented (maybe it just
got lost during the options rewrite).
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
This changes makes the default value match what is specified by the
documentation.
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
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
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_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.
|
|
|
|
| |
This is to make the method name more in line with what it does
|
| |
|
|
|
|
|
| |
This ensures that /etc/bcfg2-web.conf gets read, even if the
--web-config for [reporting].config options are not given
|
|
|
|
| |
This also fixes some extraneous calls in the option parsing loop.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
| |
It hasn't been parsed at this stage anyway.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|