summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge "Add generic PasteDeploy app and filter factories"Jenkins2012-04-042-0/+273
|\ \ | |/ |/|
| * Add generic PasteDeploy app and filter factoriesMark McLoughlin2012-03-262-0/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These generic factories allow us to dump copied and pasted app_factory and filter_factory methods. The main difference is the paste configuration changes from: [app:myapp] paste.app_factory = myapp:app_factory ... [filter:myfilter] paste.filter_factory = myapp:filter_factory to this: [app:myapp] paste.app_factory = openstack.common.pastedeploy:app_factory openstack.app_factory = myapp:App ... [filter:myfilter] paste.filter_factory = openstack.common.pastedeploy:filter_factory openstack.filter_factory = myapp:Filter Apart from reducing code duplication, this will also allow us to have the generic factories inject other data into the apps and filters. This could implemented as a new feature in PasteDeploy itself - e.g. allow the loadapp() caller supply a python object which is passed on to the factories. In the meantime, Glance has code like this to pass a ConfigOpts instance to factories. Keystone is moving a similar way, as will other projects as they move away from a global config object. Change-Id: I928d1f6da154f0f41edd624e25b8918a0e12cb28
* | Merge "Add greenthread local storage model from nova"Jenkins2012-04-042-0/+90
|\|
| * Add greenthread local storage model from novaMark McLoughlin2012-03-162-0/+90
| | | | | | | | | | | | | | | | | | | | | | Thread local storage is obviously a very useful facility to have available. Nova has a very simple API for this which uses eventlet's corolocal module and weakrefs. This looks to be generally useful and complete, so let's pull it into openstack-common. Change-Id: I52a08124297c9cb79def447436859bd8d2c0b622
* | Merge "Make 'yes' also a true boolean"Jenkins2012-03-302-4/+13
|\ \
| * | Make 'yes' also a true booleanSean Dague2012-03-222-4/+13
| | | | | | | | | | | | | | | | | | | | | Adds yes, Yes, and all other capitalizations as a true boolean. Updated unit tests to test for these. Change-Id: I97915f870dd6bba612f74f0ceb78f2399fd81a93
* | | Typofix, OptionGroup should be OptGroup.Rick Harris2012-03-291-2/+2
| | | | | | | | | | | | Change-Id: I67473bb847759ce719876e08f8a894e000f11bb3
* | | Create openstack/common/__init__.pyRick Harris2012-03-281-5/+16
| | | | | | | | | | | | | | | | | | Fixes bug 967808 Change-Id: Ic4c1fc5520cb96f40b6ed87bfff024906f983235
* | | Use absolute import for iniparser.Rick Harris2012-03-281-1/+1
|/ / | | | | | | | | | | Fixes bug 967400 Change-Id: I0c028f6b5285cd641dedbcea3132224e404b004e
* | Added a universal style-guide for all OS projects.Andrew Bogott2012-03-221-0/+257
| | | | | | | | | | | | | | | | Pursuant to a recent mailing list discussion, this file contains the union of all style recommendations from varions openstack projects. The file will be removed from individual projects. Change-Id: I79c118ff749d7c89d7d88302279ec8cb1530868d
* | Merge "Finish implementing MultiStrOpt"Jenkins2012-03-224-34/+359
|\ \
| * | Finish implementing MultiStrOptJohannes Erdfelt2012-03-224-34/+359
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Avoid leaking secrets into config logging."Jenkins2012-03-222-7/+32
|\ \ \ | |/ / |/| |
| * | Avoid leaking secrets into config logging.Eoghan Glynn2012-03-222-7/+32
| |/ | | | | | | | | | | | | | | | | Implements bp cfg-password-options Allow options to be declared secret so that their value is obfuscated before logging. Change-Id: Ie2168d218b029d9c12fa5b48342cd5b17b2cc77a
* / Add auth_str_equal() to common utils.Russell Bryant2012-03-192-0/+30
|/ | | | | | | | | | | This function provides a constant-time string comparison. Its primary use case is for authentication to avoid timing vulnerabilities. Similar functions currently exist in keystone, nova, and swift. The three diverged in slight ways immediately after going in. This version comes from keystone, which I consider the "best" version to promote to openstack-common. Change-Id: I39537a21be8a402e34e526466f6b90188344a35d
* Merge "Fix bug 954488"Jenkins2012-03-141-1/+1
|\
| * Fix bug 954488Joe Gordon2012-03-131-1/+1
| | | | | | | | Change-Id: I99b764310c575e70aff4a6790e8ba8f55e43deeb
* | Import cfg module directly if not in pathJason Kölker2012-03-091-4/+27
|/ | | | | | | | | | | | | If openstack.common is not installed, but another module has declared the openstack namespace an ImportError is thrown since the common doesnt exist in the openstack namespace. This falls back to importing cfg directly from ./openstack/common/cfg.py. Also ensures that openstack/__init__.py exists in the destination * Fixes LP951197 Change-Id: I88c26fb7cc1aed97e66b068e4f0562b1f00b2b29
* fix restructuredtext formatting in docstringsDoug Hellmann2012-03-091-20/+23
| | | | | | | | | | | | 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
* Add ConfigOpts.print_help()Mark McLoughlin2012-02-222-0/+14
| | | | | | Keystone uses this optparse method. Change-Id: Ic840b2fb2234a12cd94ca671a8d90cd2affe3a5e
* Promote more complete support for ISO 8601 time.Eoghan Glynn2012-02-203-5/+131
| | | | | | | | | | | | | | | Support for ISO 861 time representation is now duplicated in nova: https://github.com/openstack/nova/commit/c30193fbf and in glance: https://github.com/openstack/glance/commit/f8f9f171 Note this patch introduces a new dependency on python-iso8601, which has already been packaged for Fedora, EPEL and Ubuntu/Debian. Change-Id: I87c32effa97d3b7a8d869522b62c0c6fb31bcef8
* cfg: fix a small comment typoZhongyue Luo2012-02-201-1/+1
| | | | Change-Id: I2646d7e674ef3d1759558e820f051cc5e7f3b4ae
* Merge changes I71d99f00,Ib91b5af0Jenkins2012-02-203-11/+77
|\ | | | | | | | | | | * changes: Add git changelog method. Add git vcsversion method.
| * Add git changelog method.Monty Taylor2012-02-093-11/+50
| | | | | | | | Change-Id: I71d99f00b2154bf151a1521016118ba6bd088f79
| * Add git vcsversion method.Monty Taylor2012-02-091-0/+27
| | | | | | | | | | | | | | | | Leaving in the branch_nick for now - I think we need to go through the projects using this code and ensure that they aren't going to get screwed before we remove it. Change-Id: Ib91b5af050244f44cd811ca47cb6e2c53ef74ddb
* | Merge "Use default values for requirements parsing."Jenkins2012-02-201-5/+2
|\ \
| * | Use default values for requirements parsing.Monty Taylor2012-02-091-5/+2
| |/ | | | | | | Change-Id: I88a38441d8f3e6e2ef02269c41d4590cbd4acbcf
* | cfg: unneeded multiple inheritanceZhongyue Luo2012-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* | PEP8 cleanup (openstack-common)Zhongyue Luo2012-02-117-33/+32
| | | | | | | | | | | | | | | | | | Fixes bug #930625 Remove backslash continuations in openstack-common. Fix type checking taboos. Change-Id: I49ddb9ff5fa5af760dcfccb52cb4793b71e02f19
* | Merge "Disable ConfigParser interpolation (lp#930270)"Jenkins2012-02-102-1/+13
|\ \
| * | Disable ConfigParser interpolation (lp#930270)Mark McLoughlin2012-02-102-1/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | 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
* / Backslash continuations (misc.)Zhongyue Luo2012-02-101-25/+20
|/ | | | | | | | | | | 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
* Merge "Updated tox config for multi-python testing."Jenkins2012-02-098-34/+111
|\
| * Updated tox config for multi-python testing.Monty Taylor2012-02-068-34/+111
| | | | | | | | Change-Id: Ib1f768c6783db0e63cb51dfc767ae5a31a295c76
* | Merge "Split functions to avoid eventlet import."Jenkins2012-02-093-19/+44
|\|
| * Split functions to avoid eventlet import.Monty Taylor2012-02-063-19/+44
| | | | | | | | | | | | | | | | | | | | Some of these functions are used in setup.py. In a virtualenv based workflow, python setup.py sdist is called to create a tarball which is then installed into the virtualenv. These functions need to be in a separate file so that they can be imported by setup.py without eventlet needing to be installed. Change-Id: I6f7dc9614895b8c91135c62373b98afe55e1fc7d
* | fix namespace declarationJason Kölker2012-02-081-0/+1
|/ | | | Change-Id: Ib23b9a264173f061afeb72809a9ac40f907d419a
* Implements blueprint separate-nova-volumeapiAnthony Young2012-02-021-4/+4
| | | | | | | | [...] ** Removes flag osapi_extension and replaces with osapi_compute_extension and osapi_volume_extension [...] Change-Id: I4c2e57c3cafd4e1a9e2ff3ce201c8cf28326afcd
* Makes common/cfg.py raise AttributeErrorVishvananda Ishaya2012-02-022-1/+6
| | | | | | | * fixes bug 915039 * includes test Change-Id: I67b886be3b5af3763f52fffe54085975d61d61eb
* PEP8 type comparison cleanuplzyeval2012-02-021-1/+1
| | | | | | | | | | | | | | | | 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
* Add the Mapping interface to cfg.ConfigOptsMark McLoughlin2012-01-272-11/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Re-factor update.py to avoid breaking testsMark McLoughlin2012-01-271-56/+74
| | | | | | | | | | | | nosetests tries to import update.py and fails. Re-factor the code so that we have a main function that doesn't get executed on import. Note: setup.py would break nose similarly, except nose ignores setup.py by default. Change-Id: I609019d492f6fc2d7f2e8b6165228f879cf1ddb7
* Add a script to copy code into other projectsMark McLoughlin2012-01-261-0/+157
| | | | | | See: http://wiki.openstack.org/CommonLibrary#Incubation Change-Id: Ie90d40952909f766fdcac38379bf6b1ac1a0e5c7
* Pull openstack.nose_plugin from pypiJason Kölker2012-01-231-2/+1
| | | | Change-Id: I54372df3f42b806e37a71338d2779887d1c591ce
* Merge "Add support to cfg for disabling interspersed args"Jenkins2012-01-232-0/+53
|\
| * Add support to cfg for disabling interspersed argsMark McLoughlin2012-01-232-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add cfg test case for recursive substitutionMark McLoughlin2012-01-231-0/+8
|/ | | | | | | i.e. test that if blaa='blaa', foo='$blaa' and bar='$foo' that the value of bar after substitutions is 'blaa' Change-Id: I01d370832a871603b7cb47bfb3546f6aaad8c34d
* Get cfg test cases to 100%Mark McLoughlin2012-01-121-5/+91
| | | | | | | | | | | | * Test cfg.find_config_files() sys.argv usage * Test boolean values in cfg config files * Finish off incomplete cfg bad value test case * Test register_opts() and register_cli_opts() * Test the quiet ignoring of option/group re-registration * Test cfg print_usage() * Test explicit option group titles Change-Id: Icbe4b7c48d4785551f06873821d1be758adf942c
* Add cfg test case for exceptions' __str__ methodsMark McLoughlin2012-01-121-0/+39
| | | | | | Increases coverage from 93% to 97% Change-Id: I6a41b31e29238831fe2a888d5d64dc0bffd770c0
* Fix some cfg test case naming conflictsMark McLoughlin2012-01-121-18/+18
| | | | | | | | | | | | | As pointed out by Vish, there are duplicates of: OverridesTestCase::test_default_override OverridesTestCase::test_override SadPathTestCase::test_conf_file_not_found Also, rename the ConfigFileOptsTestCase so it is obvious they don't clash with the tests by the same name in CliOptsTestCase. Change-Id: I1d650d05d32501623cfed8f0b6399858d101ae02