summaryrefslogtreecommitdiffstats
path: root/openstack
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix broken --version command"Jenkins2012-12-051-6/+26
|\
| * Fix broken --version commandDavanum Srinivas2012-12-041-6/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | The code for lazy loading of version string was broken. The way it breaks in glance and oslo is different. This patch is just for oslo. Here we end up overriding more methods in our lazy string class to make argparse happy and added test cases to make sure we don't break again. we also sure we cache the result of the lookup so we return the same version everytime and for performance. Added a few test cases as well. Fixes LP #1085984 Change-Id: I0635899c37fa8e5a7edf282907d2a5e04aa064cb
* | Fix import order in openstack/common/lockutils.pyJoe Gordon2012-12-041-1/+1
|/ | | | Change-Id: Ia1dfa85a81bae6620c2c24c0c28a589d46ed3b04
* Merge "Add a CLI argument validation utility"Jenkins2012-12-041-0/+66
|\
| * Add a CLI argument validation utilityMark McLoughlin2012-11-291-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blueprint oslo-cliutils In nova-manage and cinder-manage, we allow command arguments to be passed as optional or positional arguments. e.g. $> nova-manage floating create 10.0.0.1/28 $> nova-manage floating create --ip_range 10.0.0.1/28 are equivalent. Once nova-manage has collected those arguments, it calls the appropriate command function with them as positional and keyword arguments. If the user forgets to supply a required argument, they merely get a TypeError with little useful information. Improve the usability of these commands using a new utility function to check that the required arguments have been supplied and raise a useful exception if not. Change-Id: If6e4a9f222a30472bbfbcd06859865bd4e37e139
* | Merge "Fixing modulename so eventlet will log properly."Jenkins2012-12-031-1/+1
|\ \
| * | Fixing modulename so eventlet will log properly.Michael Basnight2012-12-031-1/+1
| | | | | | | | | | | | | | | | | | Fixes bug 1086063 Change-Id: I1ebc3243b6db242279b05424c99013dbcf703703
* | | Merge "Fix set_default() with boolean CLI options"Jenkins2012-12-031-1/+2
|\ \ \
| * | | Fix set_default() with boolean CLI optionsMark McLoughlin2012-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Porting to argparse broke set_default() with boolean CLI options. The new test case shows this borkage. The issue is that, by default, argparse differs subtly from optparse in its handling of defaults for boolean options. Compare: >>> p = optparse.OptionParser() >>> p.add_option('--foo', action='store_true') >>> p.add_option('--bar', action='store_true', default=False) >>> p.parse_args([]) (<Values at 0x7f28aba066c8: {'foo': None, 'bar': False}>, []) to: >>> p = argparse.ArgumentParser() >>> p.add_argument('--foo', action='store_true') >>> p.add_argument('--bar', action='store_true', default=False) >>> p.add_argument('--blaa', action='store_true', default=None) >>> p.parse_args([]) Namespace(bar=False, blaa=None, foo=False) i.e. unless you specify a default for a boolean option, optparse defaults to None whereas argparse defaults to False. To get the same optparse behaviour with argparse, you need default=None. Change-Id: Ifc92a834c4ba59e939d80ac5de24d7051232f5b5
* | | | Merge "Improve cfg's argparse sub-parsers support"Jenkins2012-12-031-26/+117
|\| | |
| * | | Improve cfg's argparse sub-parsers supportMark McLoughlin2012-11-291-26/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for sub-parsers to be useful, you need some way of knowing which sub-parser was chosen during argument parsing. It's pretty obvious from the current sub-parsers test case that we don't have a convenient interface for this. One way of doing it is to use the 'dest' argument when adding sub-parsers: >>> subparsers = parser.add_subparsers(dest='cmd') >>> subparsers.add_parser('a') >>> subparsers.add_parser('b') >>> parser.parse_args(['a']) Namespace(cmd='a') The most sensible way to map this into cfg concepts is to register sub-parsers as an Opt. This way, we can make name and argument values of the sub-parser as an attribute on the ConfigOpts object: >>> def add_parsers(subparsers): ... a = subparsers.add_parser('a') ... a.add_argument('id') ... b = subparsers.add_parser('b') ... >>> CONF.register_cli_opt(SubCommandOpt('cmd', handler=add_parsers)) True >>> CONF(['a', '10']) >>> CONF.cmd.name, CONF.cmd.id ('a', '10') The handler method is a bit awkward, but each time cfg is to parse command line args it takes all the registered opts and creates a new argparse parser. So we need to be able to re-add the sub-parsers each time. Change-Id: I01bfd01bf8853cf57a9248b1663eb3da142366a4
* | | | Merge "Rename utils.py to strutils.py"Jenkins2012-12-031-0/+0
|\ \ \ \
| * | | | Rename utils.py to strutils.pyZhongyue Luo2012-11-301-0/+0
| | |/ / | |/| | | | | | | | | | | | | | | | | | Fixes bug #1083956 Change-Id: I681227e9428778adb7824a1930a33cfa5ffa13a1
* / | | Use json instead of jsonutils in rpc.impl_fake.Russell Bryant2012-12-011-2/+7
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fake rpc backend uses json just to make sure the data that was passed in can be serialized. Our jsonutils module makes this check a no-op, because it will automatically convert the data we pass in as primitive types if needed. Change this module back to using the json module directly and add a comment about why we don't use jsonutils here. Also add a test that ensures that non-primitive types raise an exception in the fake rpc driver. Change-Id: I61f46242cb98c875a94d86283e30efb24cc580ad
* | | Merge "Provide i18n to those messages without _()"Jenkins2012-11-293-5/+9
|\ \ \
| * | | Provide i18n to those messages without _()Davanum Srinivas2012-11-283-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug 1081498 There are a few log messages without _(), but a lot messages with _(). Wrap these log messages with _() in order to make the code consistent. fix missing imports for _ Pass the log message and interpolation argument(s) to the logger separately remove extra parens rework the patch against latest trunk Change-Id: Ib0a7b0f9c57aadfbc2cfc477c6123b885c9c6060
* | | | Merge "Use Service thread group for WSGI request handling"Jenkins2012-11-292-14/+14
|\ \ \ \
| * | | | Use Service thread group for WSGI request handlingDavanum Srinivas2012-11-292-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Reuse the pool from thread group in service.Service instead of creating a new green pool - Add ability to control the size of the pool in service.Service - Add a couple of tests for wsgi.Service() to test the size of pool a start/stop as well - Get rid of the wait method by using tg.add_thread - Get rid of pool in wsgi.Service - Added explicit property for host and port Fixes LP #1050379 Change-Id: I40507dc7887fb036ec594bb167cdaa42c278607e
* | | | | Merge "Qpid H/A cluster support"Jenkins2012-11-291-9/+14
|\ \ \ \ \
| * | | | | Qpid H/A cluster supportEugene Kirpichov2012-11-291-9/+14
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | Implements blueprint qpid-roundrobin-reconnect Change-Id: I01b65e6c33a238663667e9b6023b90172f1b77dd
* | | | | Merge "Hide the GroupAttr conf and group attributes"Jenkins2012-11-291-6/+6
|\ \ \ \ \
| * | | | | Hide the GroupAttr conf and group attributesMark McLoughlin2012-11-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason why an option group shouldn't have options called 'group' or 'conf'. Add a test case which would have failed because the 'conf' attribute would have been a ConfigOpts instance and fix it by making those attributes private. Change-Id: Ic3e41a546c0d1b7b6aae04e1dbac2933ac661f57
* | | | | | Merge "Fix regression with cfg CLI arguments"Jenkins2012-11-291-10/+14
|\ \ \ \ \ \ | |_|_|/ / / |/| | | / / | | |_|/ / | |/| | |
| * | | | Fix regression with cfg CLI argumentsMark McLoughlin2012-11-261-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug #1082279 Only options registered using register_cli_opt() should be available via the CLI, but since e42276a all options are added to the CLI. Also modify one of the existing unit tests to catch this problem. Change-Id: I742a4ae4e0fc17cd9ae5e4424c2edd38e2bc50a2
* | | | | Merge "Fixes import order"Jenkins2012-11-291-1/+1
|\ \ \ \ \
| * | | | | Fixes import orderZhongyue Luo2012-11-281-1/+1
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | Rearranged import order of openstack.common.rpc.matchmaker Change-Id: I034a96e459763910adf51dc8f6642d6485208732
* | | | | Merge "Fix broken --help with CommonConfigOpts"Jenkins2012-11-291-3/+3
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | Fix broken --help with CommonConfigOptsMark McLoughlin2012-11-231-3/+3
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we switched to argparse, the way help strings are interpolated have changed and broken --help with the options registered by CommonConfigOpts. Fix and add a new test case which would catch the issue. Change-Id: I10e42efe4721e22ff41d0efbf390c805ccb9a6a0
* | | | Make project pyflakes clean.Monty Taylor2012-11-2814-29/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added both a tox test-env for pyflakes and fixed the current pyflakes errors. This did actually fix a couple of bugs. The CI team has started using pyflakes on its projects and also has started using oslo for things, so ignoring pyflakes warnings on the oslo code was starting to get old. However, additionally, pyflakes is pretty solid, so we should maybe consider gating on it across the board. (% locals() is the biggest thing that we do that it doesn't like) Change-Id: Iac1ca62db301892b7863711162fcbc74807eb24f
* | | | Replace try: import with extras.try_importMonty Taylor2012-11-281-5/+2
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block form: try: import foo except: foo = None is confusing to code analysis tools looking for redefinition. It's also a common enough pattern that someone else has encoded it into a library. Let's use that instead. Change-Id: I35a5c7a7e3595a51ba1ef1886c3965f463dba04a
* | | Fix common rpc to use common logging instead of python loggingDavanum Srinivas2012-11-244-4/+4
| |/ |/| | | | | | | | | | | | | Looks like we just need to fix imports Fixes Bug #1072633 Change-Id: Iac84ae3aadbe440f9b19e184f080320e4c6cca5f
* | Fix ListOpt to trim whitespaceDavanum Srinivas2012-11-241-1/+1
| | | | | | | | | | | | | | | | | | - throw in an extra strip() in the list parsing code - add a test case to verify that it works! Fixes LP #1079299 Change-Id: I4f0864c72ecd2569d0461c301acda395c87a93e0
* | Merge "raise_on_error parameter shouldn't be passed to task function"Jenkins2012-11-241-3/+2
|\ \ | |/ |/|
| * raise_on_error parameter shouldn't be passed to task functiongongysh2012-11-231-3/+2
| | | | | | | | | | | | | | | | | | Modify the run_periodic_tasks() so that It has known parameters. Task function has the only parameter 'context' Bug #1081428 Change-Id: Ibc3da521df3dc47f8c136ade1070112fd5ea1039
* | Merge "Account for tasks duration in LoopingCall delay"Jenkins2012-11-232-4/+21
|\ \
| * | Account for tasks duration in LoopingCall delayEoghan Glynn2012-11-192-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1079725 Previously the time spent executing tasks was not accounted for when determining how much time to sleep between task runs. Now we subtract the duration of the last tasks run from the next sleep interval. Change-Id: I4b3e27d4aaa21d020159d46eea40bdd80361cea7
* | | Merge "Convenience wrapper for datetime.timedelta.total_seconds()"Jenkins2012-11-231-0/+13
|\| | | |/ |/|
| * Convenience wrapper for datetime.timedelta.total_seconds()Eoghan Glynn2012-11-191-0/+13
| | | | | | | | | | | | | | Allows time deltas in seconds to be concisely calculated for py26 and py27. Change-Id: I8987af1f892fda0a72f5eb0d45f94c595792dc78
* | Merge "update deprecated stanza"Jenkins2012-11-221-1/+1
|\ \
| * | update deprecated stanzaSean Dague2012-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | the deprecated stanza from nova had hard coded "Deprecated Config", but is now be used in not config scenarios. Update it to just "Deprecated". Change-Id: Icf86447aea6cd509e4e67fe0be7e9157006410a4
* | | Merge "updating sphinx documentation"Jenkins2012-11-206-47/+62
|\ \ \
| * | | updating sphinx documentationJoe Heck2012-11-186-47/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * adding openstack theming (copied from keystone project theme) * updating .gitignore to ignore generated API docs * updated formatting in index.rst page * updaed openstack/common/processutils.py to match hacking docstring * updated docstrings to resolve sphinx warnings Change-Id: Ie89afe20eeab1efd2daf440fc65ccdf90f723c51
* | | | Merge "Use the ThreadGroup for the Launcher"Jenkins2012-11-191-11/+4
|\ \ \ \ | |/ / / |/| | |
| * | | Use the ThreadGroup for the LauncherAngus Salkeld2012-11-131-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | Avoid duplicate code. Change-Id: I06523f846e851b2e5766a7a9b078f728c0755c5f
* | | | Merge "Change RPC cleanup ordering"Jenkins2012-11-161-1/+1
|\ \ \ \ | |_|_|/ |/| | |
| * | | Change RPC cleanup orderingJeff Peeler2012-11-121-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | RPC cleanup should occur before killing service threadgroup. Otherwise, the connection pool is going to be (attempted) emptied after the thread has been killed. Change-Id: Ie2b2aca495928b7ba39b2175202a072b3592ad72 Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
* | | Don't reference argparse._StoreActionMark McLoughlin2012-11-161-17/+2
| | | | | | | | | | | | | | | | | | | | | This is a private implementation detail of argparse, so we don't want to rely on it. Just sub-class Action instead. Change-Id: Icfcc782cc334d1bc1d4940bec23af48ead692a9d
* | | Fix minor coding style issueMark McLoughlin2012-11-161-1/+1
| | | | | | | | | | | | | | | | | | Use the same style of exception handling used everywhere else. Change-Id: I5436de1996f69ea6210f48c11ef231eb950ad21d
* | | Remove ConfigCliParser classMark McLoughlin2012-11-151-22/+6
| | | | | | | | | | | | | | | | | | This sub-class of ArgumentParser isn't really justified anymore. Change-Id: I705224b6e18e4609a8e2deba283767233b0bd578
* | | Add support for positional argumentsMark McLoughlin2012-11-151-39/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argparse makes it awkward to implement the current cfg API where we simply return the leftover arguments to the caller. Very few cfg users actually rely on this functionality and for those cases it probably makes more sense for them to explicitly register positional arguments or sub-parsers. Add support for positional arguments via a 'required' Opt attribute: opt = StrOpt('foo', positional=True) conf.register_cli_opt(opt) conf(['bar']) conf.foo == 'bar' Change-Id: Iea746d710237e1ea26c1ef4871643941d1df09bd