| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
Fixes bug 1010570
pep8 suggests the former over the latter
Change-Id: Ice3a3b1cc2eea9228fffb4ee40fc360ff79054a3
|
|
|
|
|
|
|
|
|
|
| |
Implements blueprint config-aliases
* Supports loading deprecated aliased options from a config file
* Supports using deprecated aliased CLI options
* For MultiStrOpt Can use mix of name and alias
Change-Id: I04678880bc8ee1f85335f5656367bd1437245c6e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements blueprint cfg-global-object
Add an instance of the CommonConfigOpts class to the cfg module's
global namespace.
The usage pattern is:
from openstack.common import cfg
opts = [
cfg.StrOpt('foo', default='blaa'),
cfg.StrOpt('bar', default='blaa'),
]
CONF = cfg.CONF
CONF.register_opts(opts)
def do_something_later():
print CONF.foo, CONF.bar
def main():
CONF(project='pulsar')
Change-Id: I77e87b1e186c243b2638a4b1c202f865249dafce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a few places now where we do:
for opt in self.opts:
foo(opt)
for group in self.groups:
for opt in group.opts:
foo(opt, group)
Use generators to turn this into simply:
for opt, group in self.all_opts():
foo(opt, group)
Change-Id: I7a32779c20caeb1bacb85528d7e36c3c18c6c16a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to effectively use a global ConfigOpts object, you
need to be able to initialize the global object with none of
the information we currently require at construction.
By moving those constructor args to the __call__() method,
we enable the global object usage model but also make the API
generally more flexible. For example, you can now reset the
object and re-use it for parsing a different set of config
files with the same options.
There are a couple of other minor behavior changes as a
result:
- print_usage() and print_help() no longer works before
the object has been called to parse options
- registration of duplicate short options are no longer
detected until the options are parsed
- the --config-file and --config-dir options aren't
registered until just before parsing the options since
the default set of config files can be specified at
that time
- find_file() can't be used until after the options have
been parsed, again because of the late registration
of --config-file and --config-dir
Finally, an unregister_opt() method is added to support
the re-registeration of the --config-file and --config-dir
options.
Change-Id: I650d8e299e92cbc5d10da47a7ce1b73ca8066bd0
|
|
|
|
|
|
| |
In preparation for enabling alphabetized import checking in Nova
Change-Id: I709fca6a121ba44df193757e5ad838de710c2f15
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes bug #998396
Both Nova and Keystone need to clear the overrides on their config
object between test runs. It's reasonable to expect the reset()
method would do this, so let's make it so.
Also add a clear() method with the old behaviour.
Change-Id: I192c5bb07e81f0fb844fa2fd429dc2e7133800de
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implements blueprint cfg-auto-create-groups
Remove the restriction that groups must be explicitly created. Often
you only need a group to have a name (not e.g. a title or help string)
so we can easily just auto-create groups for that case.
Change-Id: I150ab3900e3aad0068b93487c8d396d21d26cfea
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implements blueprint cfg-required-options
Add a 'required' flag to option schemas:
StrOpt('foo', required=True)
which causes a RequiredOptError exception to be raised if the
user fails to supply a value for the option on the CLI or in
a config file.
Change-Id: Ied7bb25f0c1582c4991d0f212f4871b9358b73fb
|
|/
|
|
| |
Change-Id: Iaccb71d83d957aae77fa0f6bc71952b899d3a159
|
|
|
|
|
|
|
|
|
|
|
| |
Most services have the need to locate files like api-paste.ini or
policy.json.
This new method attempts to find these files by looking alongside
the config files already parsed by ConfigOpts and, failing that,
falls back to a standard set of directories.
Change-Id: I95897816485b88f78854df194cab7872d7c5452a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements bp cfg-config-dir
Allow multiple config files to be pulled in from a config directory,
as opposed to individual config files being explicitly enumerated.
This logic is enabled using the --config-dir=/path/to/config CLI option,
causing config to be retrived from all matching /path/to/config/*.conf
files.
Sections may be re-opened across config files, and all config items
must reside in an explicitly specified section (i.e. it does not default
to [DEFAULT]). This behavior is unchanged.
Change-Id: Ia29dffe82dfb4742dcf3e8d36b376d906a2492cf
|
|
|
|
|
|
| |
* Allow an extension to be passed to find_config files, defaulting to '.conf'
Change-Id: I022a3b28d9067158e9ed0da741a5e72cb73af167
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A fairly misc bunch of changes:
- init cache before registering config-file and just let
register_cli_opt() clear the empty cache
- use @__clear_cache on set_default() and set_override() since
these are just used by the unit tests and doing so allows us
to kill _remove_from_cache()
- use @__clear_cache on reset() too
- remove recursion from _get() and the substitute param
- just use (group_name, opt_name) as the cache key
Change-Id: I66934e748eca9ec03e44d7f80a7e10d96a77d8eb
|
|
|
|
|
|
|
| |
Speedup of 'nova list' benchmark by up to 40%, eliminates 3 lines in
top-10 cProfile methods.
Change-Id: I2d4636f94d88b4a7e38d1565fdd4d1b8a89e560e
|
|
|
|
| |
Change-Id: I67473bb847759ce719876e08f8a894e000f11bb3
|
|
|
|
|
|
| |
Fixes bug 967400
Change-Id: I0c028f6b5285cd641dedbcea3132224e404b004e
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes bug 955308
Previously only multiple string options from the CLI were supported.
This change adds support for config files too and merges the results
from both CLI and config files.
Change-Id: I642408c03ed295fac050105fd4380940e876f228
|
|/
|
|
|
|
|
|
|
| |
Implements bp cfg-password-options
Allow options to be declared secret so that their value is
obfuscated before logging.
Change-Id: Ie2168d218b029d9c12fa5b48342cd5b17b2cc77a
|
|
|
|
| |
Change-Id: I99b764310c575e70aff4a6790e8ba8f55e43deeb
|
|
|
|
|
|
|
|
|
|
|
|
| |
blueprint sphinx-doc-cleanup
bug 94516
- Correct parameter declarations, list formatting, cross-references, etc.
- We don't need "let" in generate_autodoc_index.sh since we aren't doing math.
- Change conf.py to not prefix class and function names with full namespace
in generated output to save width on the screen.
Change-Id: I9adc8681951913fd291d03e7142146e9d46841df
|
|
|
|
|
|
| |
Keystone uses this optparse method.
Change-Id: Ic840b2fb2234a12cd94ca671a8d90cd2affe3a5e
|
|
|
|
| |
Change-Id: I2646d7e674ef3d1759558e820f051cc5e7f3b4ae
|
|
|
|
|
|
|
|
|
|
| |
Fixed bug #927650
In python=<2.6, collections.Mapping inherits from
collections.Sized, collections.Iterable, and collections.Container
which are also subclasses of object.
Change-Id: I6238c683324127abd9fb637748a10b6bdb2961e0
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This breaks e.g.
volume_name_template=volume-%08x
instance_name_template=instance-%08x
and is not part of the API contract anyway. We use $opt based value
interpolation.
Change-Id: I7ba566ae7c9a77322b52c67c5e1ffbffb760f0fc
|
|/
|
|
|
|
|
|
|
|
|
| |
Fixes bug #925166
This patch for packages which have few backslash continuations.
Follow up patches will be for packages network, scheduler, virt,
db/sqlalchemy, tests, and api/openstack.
Change-Id: I4200010b47b33fa8b9115b5d379b543200f6668d
|
|
|
|
|
|
|
|
| |
[...]
** Removes flag osapi_extension and replaces with osapi_compute_extension and osapi_volume_extension
[...]
Change-Id: I4c2e57c3cafd4e1a9e2ff3ce201c8cf28326afcd
|
|
|
|
|
|
|
| |
* fixes bug 915039
* includes test
Change-Id: I67b886be3b5af3763f52fffe54085975d61d61eb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes bug #910295
The None, True, and False values are singletons.
All variable *comparisons* to singletons should use 'is' or 'is not'.
All variable *evaluations* to boolean should use 'if' or 'if not'.
"== None", "== True", "== False", and "!= None" comparisons in sqlalchemy's
where(), or_(), filter(), and_(), and select() functions should not be changed.
Incorrect comparisons or evaluations in comments were not changed.
Change-Id: I087f0883bf115b5fe714ccfda86a794b9b2a87f7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements blueprint cfg-mapping interface
With cfg, option values are accessed via attributes on ConfigOpts
objects e.g.
conf = ConfigOpts()
conf.register_opt(StrOpt('foo'))
conf()
print conf.foo
One use case that isn't easily supported with option values represented
this way is iterating over all the registered options. Standard
interfaces for listing attributes on an object aren't suitable because
they will list more than just the options.
For this use case alone, it's worth having ConfigOpts implement the
mapping interface. That way we can do e.g.
for opt, value in conf.items():
print "Option %s = %s" % (opt, value)
It's interesting to compare argparse's approach to this problem - option
values are attributes on a Namespace object which has no attributes or
methods to pollute the namespace of option names. This is a nice
approach, but would mean that we would be passing around both a
ConfigOpts object and a Namespace object. That's a bit too much overhead,
and the mapping interface provides a usable workaround where there is a
conflict.
Change-Id: Ic113919a20291048f962999229c76884ebdd5ad8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements blueprint cfg-disable-interspersed-args
Nova currently relies on cfg being implemented with optparse because it
uses optparse's disable_interspersed_args()
The use case for this is if you do:
$> nova-manage --verbose create --project foo --user bar
you want invoking ConfigOpts() to return:
['create', '--project', 'foo', '--user', 'bar']
as the "extra" args rather than aborting when it doesn't recognize the
--project arg.
This is a reasonable use case for cfg to support and it should just have
{disable,enable}_interspersed_args() methods.
If we ever switch from optparse to argparse, we'll do something like this:
parser.add_argument('--verbose')
...
parser.add_argument(
'extra_args',
nargs=argparse.REMAINDER if disable_interspersed_args else '*')
...
ns = parser.parse_args(...)
extra_args = ns.extra_args
i.e. we will need an 'extra_args' multi-value positional argument in any
case and we'll just pass nargs=REMAINDER if we want trailing options to
be included in the extra args.
Change-Id: I3ecb7dc18230327cf5aaaa7d832224e64aafa40c
|
|
As described here:
http://wiki.openstack.org/CommonConfigModule
The module implements an API for defining configuration options and
reading values for those options that a user may have set in a config
file or on the command line.
The module is successfully in use in both Nova and Glance. Some work
remains in Nova to switch from using it under a gflags compatible
shim layer, but Glance is using it fully.
There doesn't appear to be any blockers to other projects moving over
to it fairly easily. Swift would perhaps be the next project to tackle.
Just to go through potential future compatibility concerns:
- Nova (the scroundrel) hackily uses the private ConfigOpts::_oparser
in order to disable interspersed args. This was just for nova-manage
and can probably be resolved some other way. In any case, Nova
shouldn't switch to openstack-common's cfg API until it removes this
hack.
- the CommonConfigOpts subclass set of logging related options is
perhaps assuming too much about what configuration options should
be common across all the projects. However, it seems a fairly sane
set and the worst that can happen is that projects avoid using it.
- the parameters to the Opt constructor fairly closely mirror
optparse, but they're fairly generic and shouldn't prevent us from
switching to e.g. argparse
- stuff like %prog expansion in the ConfigOpt's usage ctor param is a
similar concern, but it's a very minor concern.
- find_config_files() search path is perhaps too much policy for
openstack-common; however, it is probably as generic as it could
be and projects which need a different policy can just not use
the function
On the whole, I think we're in good shape wrt future compatibility.
Change-Id: I279a9db7806d80aff3b9b085b4a9e4fb193662f9
|