summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update TOX_CONSTRAINTS_FILE for stable/xenastable/xenaOpenStack Release Bot2021-09-101-1/+1
| | | | | | | | | | | | Update the URL to the upper-constraints file to point to the redirect rule on releases.openstack.org so that anyone working on this branch will switch to the correct upper-constraints list automatically when the requirements repository branches. Until the requirements repository has as stable/xena branch, tests will continue to use the upper-constraints list on master. Change-Id: If6be159a924060be90cd8cfb62270c0b6c5964bd
* Update .gitreview for stable/xenaOpenStack Release Bot2021-09-101-0/+1
| | | | Change-Id: I2e52a203f814e1f519047cf8d99e62f48130ef02
* Merge "Colourise and automatically page help output"xena-em3.9.0Zuul2021-08-063-38/+57
|\
| * Colourise and automatically page help outputZane Bitter2021-07-123-38/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the autopage library we can automatically send the help output to a pager (less, by default), git-style. The pager is configured to not reset the terminal on exit, avoiding the problem when piping to less manually that the help text you want to refer to disappears off the screen when you go to use it. The pager is only invoked when the output is to the terminal. Since we invoke the pager, we can ensure that it is correctly set up to interpret ANSI escape codes, so it is safe to use colour to make the output easier to read. The autopage library provides light styling of the default argparse help output, and some additional colour highlighting is added here for the command list (which is generated by cliff, not using argparse's formatting code). Change-Id: If9e1aa5166da32c58cc0fa617f4f81eaa9b2c470 Depends-On: https://review.opendev.org/c/openstack/requirements/+/799343
* | Merge "Update unit test to satisfy python3.10+"Zuul2021-08-061-1/+1
|\ \
| * | Update unit test to satisfy python3.10+Joel Capitao2021-06-151-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fedora is already testing Python 3.10 [1] and an issue has been raised [2]. All the details are in the BZ ticket but TLDR is that "optional arguments" was replaced with "options [3]. So, I used assertRegexp to accept both of them (i.e "optional arguments" and "options"). [1] https://fedoraproject.org/wiki/Changes/Python3.10 [2] https://bugzilla.redhat.com/show_bug.cgi?id=1914138 [3] https://github.com/python/cpython/commit/fb35fa49d192368e94ffec09c092260ed0fea2e1 Change-Id: I18d9f1bea7bb5a7afb273550314c36da7b466a69
* | Merge "Add conflict_handler parameter as attribut in Command class"Zuul2021-07-202-1/+48
|\ \ | |/ |/|
| * Add conflict_handler parameter as attribut in Command classmatbu2021-06-042-1/+48
| | | | | | | | | | | | | | | | | | | | Adding conflict_handler as attribut in the Command class in order to be able to take control of this parameter and change to different behavior that argparse is handling: error / resolve / ignore. Callers will be able to override it and get a proper Parser object. Change-Id: I327ece99a04bc8b2ebfa554dea643b1f2a456336
* | Handle SIGPIPE exit gracefullyZane Bitter2021-06-072-0/+48
|/ | | | | | | | | If we are piping output to a command that exits before the entire output is written (e.g. "head") then we will receive a BrokenPipeError. This is expected and we should react by exiting gracefully, setting an appropriate return code (128 + SIGPIPE). Change-Id: I0d60e44450da1f48dbd8f459549da80fda69aad5
* Merge "setup.cfg: Replace dashes with underscores"3.8.0Zuul2021-05-141-4/+4
|\
| * setup.cfg: Replace dashes with underscoreslikui2021-05-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setuptools v54.1.0 introduces a warning that the use of dash-separated options in 'setup.cfg' will not be supported in a future version [1]. Get ahead of the issue by replacing the dashes with underscores. Without this, we see 'UserWarning' messages like the following on new enough versions of setuptools: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead [1] https://github.com/pypa/setuptools/commit/a2e9ae4cb Change-Id: Icccc9cc2b3a0d236746c4b58a8815d25d8b0a443
* | Replace getargspec with getfullargspeclikui2021-05-134-14/+6
|/ | | | | | | | inspect.getargspec() is deprecated since py3 [1] https://docs.python.org/3/library/inspect.html#inspect.getargspec Change-Id: I7a1692d9979e9ffaf781de1f39f5bfa59a01cf3c
* Use py3 as the default runtime for toxsongwenping2021-04-201-1/+1
| | | | | | | | | | | | | | | | | Moving on py3 as the default runtime for tox to avoid to update this at each new cycle. Wallaby support officially the following runtimes [1]: - Python 3.6 - Python 3.8 During Victoria Python 3.7 was used as the default runtime [2] however this version isn't longer officially supported. [1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby [2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria Change-Id: I5d419e881a42e627fd0699cb2ab68b66e7295cee
* Add Python3 xena unit testsOpenStack Release Bot2021-03-191-1/+1
| | | | | | | | | | | This is an automatically generated patch to ensure unit testing is in place for all the of the tested runtimes for xena. See also the PTI in governance [1]. [1]: https://governance.openstack.org/tc/reference/project-testing-interface.html Change-Id: Id810ebcb6620b4f6235ef3d616b858b4ab6b18b4
* requirements: Uncap PrettyTablewallaby-em3.7.0Stephen Finucane2021-02-114-14/+7
| | | | | | | | | | | | | | | | | | | | | | | PrettyTable was capped at a < 0.8, which meant we were getting the veritably ancient 0.7.2 release first release in April 2013 (!) [1]. The project is now being maintained as a Jazzband project [2], meaning we should switch to this new version. The only significant change required here is that we no longer set the 'min_width' attribute since that actually does something - the wrong thing - now. We want this attribute to set a lower bound on the wrap width as opposed to an absolute minimum we can use, which is what setting the 'min_width' attribute would do. While we're here, we also remove a now useless bit of Python 2 code and bump cmd2 to a slightly newer version. [1] https://pypi.org/project/prettytable/#history [2] https://github.com/jazzband/prettytable Change-Id: Iceac729e7a9429e8ab25c60524a48d0aaeebeb37 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Depends-On: https://review.opendev.org/c/openstack/requirements/+/774917
* Merge "Add '--sort-ascending', '--sort-descending' parameters"Zuul2021-02-103-21/+82
|\
| * Add '--sort-ascending', '--sort-descending' parametersStephen Finucane2021-01-293-21/+82
| | | | | | | | | | | | | | Allow users to reverse sorting direction. Change-Id: Iecd539139c5a7ce4abaaee2ff5632a2459437d51 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "Make 'FormattableColumn' comparable"Zuul2021-02-103-0/+27
|\ \ | |/
| * Make 'FormattableColumn' comparableStephen Finucane2021-01-293-0/+27
| | | | | | | | | | | | | | | | | | | | Implement the '__lt__' magic method, thus providing the minimal set of rich comparison methods necessary to support sorting. This will allows users using these formatters for the more basic types (i.e. not dicts) to sort their output using the standard '--sort-column' option. Change-Id: I08e1f1bc75fa6452f19dfb9d221c1daec194d58d Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "Handle null values when sorting"Zuul2021-02-093-7/+80
|\ \ | |/
| * Handle null values when sortingStephen Finucane2021-01-293-7/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One unfortunate change (or fortunate, depending on how you look at types) in Python 3 is the inability to sort iterables of different types. For example: >>> x = ['foo', 'bar', None, 'qux'] >>> sorted(x) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: '<' not supported between instances of 'NoneType' and 'str' Fortunately, we can take advantage of the fact that by providing a function for the 'key' that returns a tuple, we can sort on multiple conditions. In this case, "when the first key returns that two elements are equal, the second key is used to compare." [1] We can use this to first separate the values by whether they are None or not, punting those that are not to the end, before sorting the non-None values normally. For example: >>> x = ['foo', 'bar', None, 'qux'] >>> sorted(x, key=lambda k: (k is None, k)) ['bar', 'foo', 'qux', None] We were already using this feature implicitly through our use of 'operator.itemgetter(*indexes)', which will return a tuple if there is more than one item in 'indexes', and now we simply make that explicit, fixing the case where we're attempting to compare a comparable type with None. For all other cases, such as comparing a value that isn't comparable, we surround things with a try-catch and a debug logging statement to allow things to continue. Note that we could optimize what we're done further by building a key value that covers all indexes, rather than using a for loop to do so. For example: >>> x = [('baz', 2), (None, 0), ('bar', 3), ('baz', 4), ('qux', 0)] >>> sorted(x, key=lambda k: list( ... itertools.chain((k[i] is None, k[i]) for i in (0, 1))) ... ) [('bar', 3), ('baz', 2), ('baz', 4), ('qux', 0), (None, 0)] However, this would be harder to grok and would also mean we're unable to handle exceptions on a single column where e.g. there are mixed types or types that are not comparable while still sorting on the other columns. Perhaps this would be desirable for some users, but sorting on a best-effort basis does seem wiser and generally more user friendly. Anyone that wants to sort on such columns should ensure their types are comparable or implement their own sorting implementation. [1] https://www.kite.com/python/answers/how-to-sort-by-two-keys-in-python Change-Id: I4803051a6dd05c143a15923254af97e32cd39693 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: 2008456 Task: 41466
* | Merge "gitignore: Ignore reno artefacts"Zuul2021-02-091-7/+4
|\ \ | |/
| * gitignore: Ignore reno artefactsStephen Finucane2021-01-271-7/+4
| | | | | | | | | | Change-Id: I27a3689c2e22452c082764eed8d26cd8f3bbcd13 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Remove unicode from codexuanyandong2021-01-286-18/+18
|/ | | | Change-Id: I040fccd1714dccd7a87aaf10d397ad3a3ef476d3
* Remove lower-constraintsStephen Finucane2021-01-273-50/+10
| | | | | | | | | | | | This is not part of the PTI and is currently broken. While discussions are ongoing about removing it from every project, there's a definite lean towards doing so. Let's do just that. We can re-add in the future if necessary. While we're here, we fix some indentation in 'tox.ini'. Change-Id: Ib4784d9da96d05a54acdfbb3744af0cb053c0c6c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Merge "trivial: Remove references to Python 2.7"3.6.0Zuul2020-11-182-56/+27
|\
| * trivial: Remove references to Python 2.7Stephen Finucane2020-11-182-56/+27
| | | | | | | | | | | | | | There were some in both the docs and the demo application. Change-Id: I58d14cd3a372f9bdf617cbfbcb5ce34169ac83f8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "Remove six"Zuul2020-11-1826-322/+94
|\ \ | |/
| * Remove sixxuanyandong2020-10-2926-322/+94
| | | | | | | | | | | | | | | | | | | | | | | | Replace the following items with Python 3 style code. - six.moves - six.PY2 - six.PY3 - six.string_types - six.text_type Change-Id: I1656b976864c8f2343e658a4abf432d30c151d0b
* | Merge "List setuptools under install_requires"Zuul2020-11-091-0/+1
|\ \
| * | List setuptools under install_requiresLouis Sautier2020-10-011-0/+1
| | | | | | | | | | | | | | | | | | | | | pkg_resources is used at runtime, making setuptools a runtime dependency. Change-Id: Ib1775a319e8ed953cb34e3c09809b8ca7a32b947
* | | Merge "Update requirements URLs in tox config"3.5.0Zuul2020-11-061-1/+1
|\ \ \
| * | | Update requirements URLs in tox configlikui2020-10-301-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | Update the URL to the upper-constraints file to point to the redirect rule on releases.openstack.org so will switch to the correct upper-constraints list automatically when the requirements repository branches. Change-Id: Ia69a02b539230e65e25da65d5d76a9f650490256
* | | columns: Make 'FormattableColumn' comparableStephen Finucane2020-11-041-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, comparing instances of this fails: >>> from cliff.columns import FormattableColumn >>> class Test(FormattableColumn): ... def human_readable(self): ... return str(self._data) ... >>> data = {'x': 'y'} >>> x = Test(data) >>> y = Test(data) >>> x == y False Clearly it should not. Resolve this by implementing a custom comparison. Change-Id: I4b96475ca6a689f4055dc5ea34b82b3867a65555 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2008320 Task: #41218
* | | Merge "Update requirements"Zuul2020-10-291-1/+1
|\ \ \
| * | | Update requirementslikui2020-10-291-1/+1
| |/ / | | | | | | | | | | | | | | | | | | We also need to change the lower-constraint requirements to make them py3.8 compatible. See https://bugs.launchpad.net/nova/+bug/1886298 Change-Id: Id06963dfdb20074cb9d8f0f2416a8e0937006059
* | | Merge "Add py38 package metadata"Zuul2020-10-291-0/+1
|\ \ \ | |/ / |/| |
| * | Add py38 package metadatalikui2020-10-191-0/+1
| | | | | | | | | | | | Change-Id: I76f87914149dc845ec53ec6a64342ca59f7dc4dc
* | | doc: Update bug tracker to storyboardAkihiro Motoki2020-10-234-8/+8
| | | | | | | | | | | | | | | | | | | | | cliff now uses storyboard as the bug tracker, but the documents have not been updated. Change-Id: Ie2ceda088f708dee2d6dd0877087e9a5c27e928f
* | | Remove references to setuptoolsStephen Finucane2020-10-225-26/+15
|/ / | | | | | | | | | | | | | | With the advent of importlib, entry points are no long a setuptools-only thing. Update the docs to reflect that. Change-Id: I099f397ddb4d71879597cfe67ef2a1eff4a8d1af Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Remove Babel from lower-constraints.txtsongwenping2020-10-131-1/+0
| | | | | | | | | | | | This can be removed because it's no longer a transitive dependency of oslo.i18n. Change-Id: I2dabd2eea6d589952ecabf203f3c0d075672799f
* | Bump py37 to py38 in tox.inisongwenping2020-10-061-1/+1
|/ | | | | | In wallaby cycle, we should test py38 by default. Change-Id: If1644b27dfe7b94d9fd709bbd9bc5d93afb2a374
* Merge "Add Python3 wallaby unit tests"Zuul2020-09-141-1/+1
|\
| * Add Python3 wallaby unit testsOpenStack Release Bot2020-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is an automatically generated patch to ensure unit testing is in place for all the of the tested runtimes for wallaby. See also the PTI in governance [1]. [1]: https://governance.openstack.org/tc/reference/project-testing-interface.html Change-Id: Ibde6e46f32d027992e65bd1446d3e84bcf0b3879
* | Document KeyboardInterrupt exit codeZane Bitter2020-09-091-3/+7
| | | | | | | | Change-Id: Ib97cbf2c9b108932c437a6d69a6ab629244702b3
* | Exit gracefully on Ctrl-CZane Bitter2020-09-092-16/+59
| | | | | | | | | | | | | | | | | | If we receive SIGINT, exit gracefully: run the clean_up method; don't print a stacktrace; exit with error code 130 (128 + SIGINT). Change-Id: I77687133d5482912523814a28e42f4f3a1a146d5 Story: 2008124 Task: 40846
* | change help action to use its own exception for exitDoug Hellmann2020-09-093-8/+20
|/ | | | | | | | | | | | | Provide a new exception class for the help action to use to indicate that the app should exit, instead of calling sys.exit(). This allows argument parsing errors in interactive mode to print help without exiting the entire application, while still being treated as a short-cut to avoid every command plugin having to process argument errors itself. Change-Id: If882b305ff9186f97ece6c77ef8c1b888c24a72d Story: 2008071 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* Capturing argparse errors due to problem with cmd2Thiago Paiva Brito2020-08-281-0/+4
| | | | | | | | | | | | | | The Bifrost team got an errors on their CLI that also affects OSC. When in interactive mode, if argparse fails to parse the input due to, say, a missing parameter, argparse by default thows a SystemExit(2), but cmd2 doesn't like it because that could've been a signal to stop the CLI, so it breaks the interactive session. This fix aims to bypass that and keep the CLI running so we don't have to start it at every parameter we forget to type in. Change-Id: I0e2006a9625e2f8dbdbc0e5921acfb3853a06ee9 Story: 2008071 Task: 40782
* switch to stevedore for loading entry pointsvictoria-em3.4.0Doug Hellmann2020-07-055-24/+24
| | | | | | | | | Switch to using stevedore now so that when the cache implementation is released all cliff applications can take advantage of the performance benefits. Change-Id: Ib7bf53091470b55ab87082d315ca283d3600a636 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* Remove cap on cmd23.3.0Rodolfo Alonso Hernandez2020-06-122-1/+11
| | | | | | | | | | | | After [1] and [2], there is no need to cap the version of cmd2. This will also fix the current "rally_openstack" import problems experienced in the CI: http://paste.openstack.org/show/794701/ [1]https://review.opendev.org/#/c/712591/ [2]https://review.opendev.org/#/c/734629/ Change-Id: Ie15e3f5058c4bd104978d9f31f0590d6c795024b