summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Adds support for bol and eol spaces to ini filesVishvananda Ishaya2012-06-062-1/+13
| |/ / | | | | | | | | | | | | | | | | | | * Fixes bug 1009639 * Adds tests Change-Id: Id00563dfcc6f143c3e86ec380d66cffc967b8c48
* / / Move testing dependencies to test-requires.Vishvananda Ishaya2012-06-062-3/+3
|/ / | | | | | | Change-Id: If0402077cc95811936c55182d90f15ccb37a6ad2
* | Revert "Add a load function wrapper to jsonutils"Russell Bryant2012-06-061-8/+3
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 72840edc736b7f4d2366b5049f6516d8f5b901ff. This change breaks kombu, so revert it since there is no specific need for it. Fixes bug 1009127. Change-Id: Id0ef8b3948b63d0151289cb7ce8e617d9816bb4b
* | Add gettext support.Russell Bryant2012-06-062-0/+63
|/ | | | | | | | | | This patch adds gettext support for openstack-common modules. In the process of pulling in the rpc code, I didn't want to remove the usage of _() that was already in there. This allows it to stay in a way that doesn't conflict with gettext usage in the project using openstack-common. Change-Id: I9cad006f81244f0cce7b7f28659fa1daa5a4268a
* Replace datetime.utcnow with timeutils.utcnowZhongyue Luo2012-06-051-1/+1
| | | | | | | | Fixes bug #1008064 Replaced datetime.utcnow usage with timeutils.utcnow Change-Id: I8bfdc1abefc3891497554335a3078d4028ef8ac9
* Merge "Create testutils with skip decorators."Jenkins2012-06-052-0/+111
|\
| * Create testutils with skip decorators.Russell Bryant2012-06-042-0/+111
| | | | | | | | | | | | | | | | This patch creates openstack.common.testutils which includes some decorators used to conditionally skip tests. This is needed for the rpc unit tests. Change-Id: Ic6bc8d58f7dfcd9eb3acd2749c475b9d760b9578
* | Common-ize policies.Kevin L. Mitchell2012-06-042-0/+639
|/ | | | | | | | | | | | | | | | | Both Glance and Nova make use of (almost) the same policy system, defined in glance/common/policy.py and nova/common/policy.py, respectively. They also have independent glue code (glance/api/policy.py and nova/policy.py), so that the common policy system is substantially similar. This makes policies a perfect candidate for incorporation into openstack-common, particularly given that this same code will soon be used by Quantum. This change adds the common policy module (along with some minor interface changes and bug fixes) to openstack-common, along with a test suite. Change-Id: I0022a91f16ded28f9dc6b4975ef1b6e4cc8460ac
* Fix pep8 errors.Kevin L. Mitchell2012-06-042-7/+7
| | | | | | Fixes a couple of pep8 errors that appeared due to a pep8 tool update. Change-Id: Ida70b1fb962529d3a157f44dcf2e71af773a4431
* Add a load function wrapper to jsonutilsZhongyue Luo2012-06-041-3/+8
| | | | | | Fixes bug #1008065 Change-Id: I72aba29eea4637643cb7742f2fd4b1f05d15667f
* cfg: add a global CONF objectMark McLoughlin2012-05-291-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* cfg: add generators for iterating over all optionsMark McLoughlin2012-05-291-28/+24
| | | | | | | | | | | | | | | | | | 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
* cfg: move constructor args to __call__() argsMark McLoughlin2012-05-293-81/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Added support for proper bare URLs.Monty Taylor2012-05-251-0/+17
| | | | | | | | | If we want to use github zipballs as a source of depends sometimes (which we do) - we need to have the pip-requires parsing understand that lines starting with http:// or https:// are urls and should go to dependency_links. Change-Id: I9218159872d6edfebd4b820e6db912e9aabdf7d7
* Backslash continuation removal (common folsom-1)Zhongyue Luo2012-05-191-4/+4
| | | | | | | | Fixes bug #1001361 Removes backslash continuations Change-Id: I86fbb950b48a7681b3c1a010b0d0007cd2f12632
* Run pep8 on tests.Russell Bryant2012-05-162-2/+3
| | | | | | | I noticed that pep8 wasn't running on the tests. This patch fixes that, as well as a couple of pep8 errors in test_cfg. Change-Id: I4429bfe6813a2e9394efb1753cbebbadb9f23833
* Create openstack.common.jsonutils.Russell Bryant2012-05-153-0/+252
| | | | | | | | | | | | | | | | | | | | This patch creates a new module, jsonutils. It is based on some code from nova.utils that is used by nova.rpc. It is being added to openstack-common as another step toward being able to eventually move nova.rpc to openstack-common. This module provides a few things: 1) A handy function for getting an object down to something that can be JSON serialized. See to_primitive(). 2) Wrappers around loads() and dumps(). The dumps() wrapper will automatically use to_primitive() for you if needed. 3) This sets up anyjson to use the loads() and dumps() wrappers if anyjson is available. Change-Id: I41e5759360d515ed53defe69f3e8247aafbcc83a
* Merge "Alphabetize imports in openstack/common/cfg.py"Jenkins2012-05-151-1/+1
|\
| * Alphabetize imports in openstack/common/cfg.pyJoe Gordon2012-05-141-1/+1
| | | | | | | | | | | | In preparation for enabling alphabetized import checking in Nova Change-Id: I709fca6a121ba44df193757e5ad838de710c2f15
* | Remove unused imports.Russell Bryant2012-05-141-2/+0
|/ | | | | | This patch removes a couple of unused impots from test_utils. Change-Id: I40a2f4086e33dbcdb2eceb699c82a1350665c181
* Merge "cfg: make reset() clear defaults and overrides"Jenkins2012-05-142-4/+62
|\
| * cfg: make reset() clear defaults and overridesMark McLoughlin2012-05-122-4/+62
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Tests to cover various mailmap formats.Bhuvan Arumugam2012-05-121-6/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 994957 Mailmap might include entries in different format: Full Name <email@foo.com> Full Name <email@bar.com> Firstname <email@foo.com> Firstname <email@bar.com> <email@foo.com> <email@bar.com> This commit adds a test case to parse these entries. * tests/unit/test_setup.py Remove unused imports. Import os and setup methods to verify. SetupTest: Define unique test case name. setUp(): New method to define temporary mailmap file. tearDown(): New method to remove the temporary mailmap file. test_mailmap_with_fullname(): New method to test mailmap entry with fullname. test_mailmap_with_firstname(): New method to test mailmap entry with first name only. test_mailmap_with_noname(): New method to test mailmap entry with just email addresses. Change-Id: Icc018d4b2692ce7a7de757f02d1dd49241c30a6c
* Merge "cfg: automatically create option groups"Jenkins2012-05-102-9/+29
|\
| * cfg: automatically create option groupsMark McLoughlin2012-05-102-9/+29
| | | | | | | | | | | | | | | | | | | | 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
* | Merge "cfg: allow options to be marked as required"Jenkins2012-05-102-2/+140
|\ \
| * | cfg: allow options to be marked as requiredMark McLoughlin2012-05-102-2/+140
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* / cfg: use a list comprehension instead of map()Mark McLoughlin2012-05-101-1/+1
|/ | | | Change-Id: Iaccb71d83d957aae77fa0f6bc71952b899d3a159
* Encapsulate common sdist actions into a cmdclass.Monty Taylor2012-05-061-0/+37
| | | | | | | | | | | | The pattern of running generate_authors and write_git_changelog at sdist time is (and should be) repeated in all project's setup.py. Instead of copying the creation of the two classes and injection of them into a cmdclass dict, we can do it here and have it be consistent. Related to bug 986462. Change-Id: I0b7b44d58685551482f874b2a6091dec29e6bed6
* Truly handle mailmap entries for all combinations.Bhuvan Arumugam2012-05-041-1/+2
| | | | | | | | | | | | | | | | | | Bug: 994957 Mailmap might contain mapping with full name. This commit fixes it to handle these combinations: Foo ZZ <email@foo.com> Bar YY <email@bar.com> Foo <email@foo.com> Bar <email@bar.com> <email@foo.com> <email@bar.com> This is inline with mailmap convention described here: http://man.github.com/git/git-shortlog.html * openstack/common/setup.py parse_mailmap(): Pull out canonical and alias email addresses. Change-Id: Iabe9612efecbd18f7a5b0725de7d2515ab24125d
* Merge "Add save_and_reraise_exception()."Jenkins2012-05-022-0/+99
|\
| * Add save_and_reraise_exception().Russell Bryant2012-05-022-0/+99
| | | | | | | | | | | | | | | | | | This patch adds save_and_reraise_exception() to a new module, openstack.common.excutils. This is based on the function of the same name from nova.utils. It is used by nova.rpc, so something equivalent is needed in openstack-common before nova.rpc can be moved here. Change-Id: Icec574a081837e0f2d0548a5759d21b0352dbee6
* | Merge "Remove common.exception from common.importutils."Jenkins2012-05-022-5/+2
|\ \
| * | Remove common.exception from common.importutils.Russell Bryant2012-05-022-5/+2
| |/ | | | | | | | | | | | | | | This patch removes the usage of common.exception from common.importutils. Instead of raising exception.NotFound() from importutils.import_class(), just use the built-in ImportError. Change-Id: I95e84908d1f80c5ca3bbac049eda8faa64212ae0
* | Merge "New ConfigOpts.find_file() for locating conf files"Jenkins2012-05-022-21/+122
|\ \ | |/ |/|
| * New ConfigOpts.find_file() for locating conf filesMark McLoughlin2012-05-012-21/+122
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Support for directory source of config files"Jenkins2012-05-012-56/+157
|\|
| * Support for directory source of config filesEoghan Glynn2012-04-302-56/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Update exception from importutils.import_class()."Jenkins2012-04-301-2/+3
|\ \
| * | Update exception from importutils.import_class().Russell Bryant2012-04-281-2/+3
| |/ | | | | | | | | | | | | | | | | | | Update the message included in the exception from importutils.import_class() to include what the inner exception was. This is quite helpful as the real error may not have been that the class was not found. It may have failed to import the module that contains that class, and it's nice to know that and why that happened. Change-Id: I085864d230b46adce8921e362f058f9421a5a674
* / Handle authors existed before VCS was around.Bhuvan Arumugam2012-04-301-7/+12
|/ | | | | | | | | | | | | | Bug: 976267 The list of such authors are stored in AUTHORS.in file. When auto generating AUTHORS file, include them as well. * openstack/common/setup.py __doc__: For all methods, remove space and include period. generate_authors(): If AUTHORS.in file exist, append the content to AUTHORS file. Change-Id: I05da1e561383cc151e7ef34e75a4600e3afdda6e
* Fix ordering in HACKING.rstJoe Gordon2012-04-261-1/+1
| | | | | | | | | | Already fixed in nova. Switched: from nova.endpoint import cloud import nova.flags Change-Id: I5d4f64d0710c8bb12031c3960401f6d6d2a67843
* Provide file extension when when looking for filesBrian Waldon2012-04-262-5/+16
| | | | | | * Allow an extension to be passed to find_config files, defaulting to '.conf' Change-Id: I022a3b28d9067158e9ed0da741a5e72cb73af167
* Some refactoring of the cfg cacheMark McLoughlin2012-04-241-34/+12
| | | | | | | | | | | | | | | | | | | 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
* Add caching to openstack.common.cfgYuriy Taraday2012-04-241-7/+60
| | | | | | | Speedup of 'nova list' benchmark by up to 40%, eliminates 3 lines in top-10 cProfile methods. Change-Id: I2d4636f94d88b4a7e38d1565fdd4d1b8a89e560e
* Add AUTHORS generation function.Bhuvan Arumugam2012-04-121-1/+14
| | | | Change-Id: I0adbf0755a0191c7b68af9ca2f6e50c787ee7043
* Change behavior in utils.import_object().Russell Bryant2012-04-116-43/+98
| | | | | | | | | | | | | | | | | | | Fix bug 972859. Prior to this patch, utils.import_object(foo) and utils.import_class(foo) would return the same thing if foo was the path to a class. This patch changes utils.import_object() to return an instance of the class, instead, also allowing you to pass in arguments to the constructor. This patch also removes the odd behavior of import_object() to be able to also import a module. Instead, a new function import_module() has been added. Finally, the three import helpers have been moved to a new module, importutils. Change-Id: Ia2ea64c965692f8c3a29adec332dd93a83980070
* Move auth_str_equal() to a new authutils module.Russell Bryant2012-04-114-30/+73
| | | | | | | This patch moves auth_str_utils() to a new module, authutils, for helper functions related to authentication. Change-Id: I83f174486269701deed3500f890832a71ff3e315
* Merge "Create openstack.common.timeutils."Jenkins2012-04-114-180/+230
|\
| * Create openstack.common.timeutils.Russell Bryant2012-04-044-180/+230
| | | | | | | | | | | | | | Split time related utility functions out of openstack.common.utils into a new module, timeutils. Change-Id: Ic09952cd48e0b4548e410926cc456cbd515a4e56