summaryrefslogtreecommitdiff
path: root/keystoneclient/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Handle UTC+00:00 in datetime stringsMonty Taylor2017-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, the following: datetime.datetime.now(tz=iso8601.iso8601.UTC).tzinfo.tzname() returns: 'UTC+00:00' rather than: 'UTC' resulting in strings that look like: 2013-03-04T12:00:01.000000UTC+00:00 That is just flatly invalid. The code here accounts for a tzname of "UTC" and normalizes to to being a trailing Z as-per the ISO 8601 spec, but it does not account for UTC+00:00. Add support for that so that we don't produce invalid date strings. Most of this can be avoided by replacing use of this function with the isoformat method of datetime instead. datetime.datetime.now(tz=iso8601.iso8601.UTC).isoformat() Produces 2013-03-04T12:00:01.000000+00:00 Which while different from 2013-03-04T12:00:01.000000Z is still a valid iso8601 string. Change-Id: I52ca7561abee158285c2c98ba63d84c62e12360f
* Remove use of positional decoratorMorgan Fainberg2017-08-071-3/+0
| | | | | | | | | The positional decorator results in poorly maintainable code in a misguided effort to emulate python3's key-word-arg only notation and functionality. This patch removes keystoneclient's dependance on the positional decorator. Change-Id: I9e691cc8b0c04992f4a8dabd67e1b413d3220d23
* Remove unused logzlyqqq2017-04-251-4/+0
| | | | Change-Id: I1fe2c1703b03eb1c8458c53bdd208a91ababf941
* Merge "Remove unauthenticated functions"Jenkins2016-11-101-24/+0
|\
| * Remove unauthenticated functionsJamie Lennox2016-08-241-24/+0
| | | | | | | | | | | | These were used by the shell which has since been removed. Change-Id: If329da4499b76799356e79099f86a4afdebb00ce
* | Use exceptions from KeystoneauthJamie Lennox2016-08-241-7/+8
|/ | | | | | | | | | | | | As keystoneclient and other services rely more on keystoneauth we should assume that keystoneauth is our base auth library, not keystoneclient and start to default to the objects provided from there. This will make it easier to remove these objects when the time comes. For the session independant parts of keystoneclient we should use the exception names as provided by keystoneauth instead of the aliases in keystoneclient. Change-Id: Ic513046f8398a76c244e145d6cc3117cdf6bb4cd
* Fixing D202 and D203 PEP257 violation.Navid Pustchi2016-05-041-3/+0
| | | | | | | | | Currently tox ignores D202 and D203. D202: No blank lines allowed after function docstring. D203: 1 blank required before class docstring. This change removes D202 and D203 ignores in tox and fix violations. Change-Id: I97ef88c9cfd56774e47f789cbbcf8ccfe85d7737
* Fix D400 PEP257 violation.Navid Pustchi2016-04-231-1/+1
| | | | | | | | Currently tox ignores D400. D400: First line should end with a period. This change removes it and make keystoneclient docstrings compliant with it. Change-Id: I29ecb4c58bb03c0b9a3be0b7a74d18fb06a350f2
* Fix D401 PEP257 violation.Navid Pustchi2016-04-231-1/+1
| | | | | | | | Currently tox ignores D401. 401: First line should be in imperative mood. This change removes it and make keystoneclient docstrings compliant with it. Change-Id: If34ff12d18390b357342cf29f2d116dd3c86a44d
* Removing bandit.yaml in favor of defaultsChristopher J Schaefer2016-04-191-2/+4
| | | | | | | | | | | Removing old configuration options for build-in defaults of latest bandit functionality. Also, marking flagged items with _# nosec_ with a descriptive comment on why the code is acceptable as is. Co-Authored-By: Christopher J Schaefer <cjschaef@us.ibm.com> Co-Authored-By: Tom Cocozzello <tjcocozz@us.ibm.com> Change-Id: I138ebd46a8be195177361a9c3306bb70423b639d
* remove CLI from keystoneclientSteve Martinelli2016-03-101-69/+0
| | | | | | | | | | | | | | | the CLI has been deprecated for a long time, and many docs and install guides recommend using OSC instead of `keystone`. - removes CLI - removes man page from docs - removes CLI tests - removes `bootstrap` from contrib - removes entrypoint from setup.cfg implements bp: remove-cli Change-Id: Icbe15814bc4faf33f513f9654440068795eae807
* use positional library instead of utilsSteve Martinelli2016-01-251-0/+2
| | | | | | swap instances of utils.positional with the positional library. Change-Id: Id8a9961e68d287a802f25512fc970829e9feb5c2
* Use positional library instead of local codeMorgan Fainberg2016-01-231-157/+1
| | | | | | | | Use the positional library instead of the local copy of the code. This will prevent duplicating code across repositories without needing to chase down weird dependency graphs. Change-Id: I7fef334666e93e358870173d29018e5d47312d2b
* Address hacking check H405lin-hua-cheng2016-01-131-3/+7
| | | | | | | | | Previously, there were a string of commits to keystone that addresed ignored hacking checks. This commit does the same for H405 in keystoneclient. This also modifies our tox.ini so that we no longer ignore H405 violations. Change-Id: I2af152e5425a0e9c82314039fdbb90d661c22680 Closes-Bug: 1482773
* Switch from deprecated oslo_utils.timeutils.strtimeBrant Knudson2015-06-301-0/+5
| | | | | | | | | | | | | | The oslo_utils.timeutils.strtime function is deprecated as of oslo_utils 1.7. DeprecationWarning: Using function/method 'oslo_utils.timeutils.strtime()' is deprecated in version '1.6' and will be removed in a future version: use either datetime.datetime.isoformat() or datetime.datetime.strftime() instead Closes-Bug: 1469867 Change-Id: I97897728703547414a621b6687989cff07e01b3e
* Switch from deprecated isotimeBrant Knudson2015-06-301-0/+30
| | | | | | | | | | | | | | | | | oslo_utils.timeutils.isotime() is deprecated as of 1.6 so we need to stop using it. The deprecation message says to use datetime.datetime.isoformat() instead, but the format of the string generated by isoformat isn't the same as the format of the string generated by isotime. The string is used in tokens and other public APIs and we can't change it without potentially breaking clients. So the workaround is to copy the current implementation from oslo_utils.timeutils.isotime() to keystone.common.utils.isotime(). Change-Id: I34b12b96de3ea21beaf935ed8a9f6bae2fe0d0bc Closes-Bug: 1461251
* Stop using function deprecated in Python 3Brant Knudson2015-06-081-1/+1
| | | | | | | | | Python 3 deprecated the logger.warn method in favor of warning. DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead Change-Id: Idbd4de3c7c631fb2c235701c9b300c37a90d9538
* Prompt for password on CLI if not providedJamie Lennox2015-05-021-0/+18
| | | | | | | | load_from_argparse_arguments is very specifically for use with argparse. We can therefore safely prompt for a password from the user if none is provided and it won't affect config options or other loading mechanisms. Change-Id: Ib76743b768c5f0eef756184f1da49613423298f0
* Switch from oslo.utils to oslo_utilsBrant Knudson2015-01-311-1/+1
| | | | | | | | oslo_utils moved out of the oslo namespace. bp drop-namespace-packages Change-Id: I72e67dc1f649ba137dd06f5ab7133858c6abd67d
* Use oslo.utils and oslo.serializationSteve Martinelli2014-10-151-3/+3
| | | | | | | Left timeutils and strutils in openstack/common since they are used in openstack/common/apiclient and memorycache. Change-Id: Idb5f09c159d907dfba84cd1f7501f650318af7d9
* Revert "Use oslo.utils"Matt Riedemann2014-08-171-3/+3
| | | | | | | | | This reverts commit 68c2fad55a71ca511ff959e589aa0a3f3dbd4b78. Looks like this broke the stable branches. :( Change-Id: I9d190e211ecfa80d573a6c48c0b485f3506fe947 Closes-Bug: #1357652
* Use oslo.utilsBrant Knudson2014-08-051-3/+3
| | | | | | | keystoneclient was using utility function from oslo-incubator rather than oslo.utils. Change-Id: I2909a2150b9556e54ef88e72358fda1cf8b7cc1c
* Fix tests to use UUID strings rather than ints for IDsBrant Knudson2014-06-021-7/+1
| | | | | | | Several tests were using ints rather than strings for IDs. The ints were changed to UUID strings. Change-Id: I65312509c72078c08ca284e313104e926d9885ba
* Sync with oslo-incubator 2640847Brant Knudson2014-05-051-2/+8
| | | | | | | | | | | | | | | Sync with oslo-incubator commit 2640847e3df7720457103d2111846c27fc8fdcd5 . First, remove the existing code to cleanup: $ rm -r keyestoneclient/openstack/* Then, sync from oslo-incubator: $ python update.py ../python-keystoneclient Change-Id: Ic94906002e0257ffc56245e49890e7ee2f3b4a2a
* fixed typos found by RETF rulesChristian Berendt2014-05-031-1/+1
| | | | | | rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos Change-Id: I67fb3e0d02c931cb7e605ac74ea8272956afa8e1
* Hash functions support different hash algorithmsBrant Knudson2014-04-091-2/+2
| | | | | | | | | | The token hash functions always used MD5. With this change, the hash function can be passed in to the hash functions. SecurityImpact Related-Bug: #1174499 Change-Id: Ia08c2d6252bb034087a244b47d5bcbea7dcfa70b
* Add a positional decoratorJamie Lennox2014-03-241-0/+161
| | | | | | | | | | | | | | | This decorator allow us to define that certain parameters are strictly keyword arguments only, without sacrificing the convenience of having those arguments listed in the function definition. This will mean that we are no longer trapped maintaining backwards compatibility for the order of keyword arguments. The enforcement levels should allow us to start putting warnings on existing functions and strict enforcement on new functions. Partial-Bug: #1295881 Change-Id: Ic0a196874930e7be8362df50594471ab8037c5b2
* Merge "Using common method 'bool_from_string' from oslo strutils"0.6.0Jenkins2014-02-131-7/+0
|\
| * Using common method 'bool_from_string' from oslo strutilsllg82122014-01-221-7/+0
| | | | | | | | | | | | | | | | | | Using common method 'bool_from_string' from oslo strutils to replace utils.string_to_bool. partially implements blueprint common-client-library-2 Change-Id: I22ee9c5a4b48e85606e033ab87d4adb72b665ee6
* | Remove vim headerEric Guo2014-02-081-2/+0
|/ | | | | | | | We don't need vim modelines in each source file, it can be set in user's vimrc. Change-Id: Ic7a61430a0a320ce6b0c4518d9f5d988e35f8aae Closes-Bug: #1229324
* Do not try to call decode() on a text stringCyril Roelandt2014-01-031-1/+1
| | | | | | | This fixes a call to 'isinstance' that only worked on Python2. Closes-Bug: #1265879 Change-Id: I886da95f1ad2a8314de92be8aecb354ee3124e6d
* Merge "Fix typo in keystoneclient"Jenkins2013-12-031-1/+1
|\
| * Fix typo in keystoneclienthuangtianhua2013-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | hypen-separated --> hyphen-separated initialzied --> initialized did't --> didn't sematics --> semantics Change-Id: I79841b76fdf7a267e325b8b9d917900ccb393c02 Closes-Bug: #1254660
* | Encode the text before print it to consoleLei Zhang2013-11-251-2/+3
|/ | | | | Closes-Bug: #1250490 Change-Id: I516806a0f8a136bb66c64dcdcd07cee6d297e619
* python3: Make iteritems py3k compatChuck Short2013-10-101-1/+2
| | | | | | | | Use six.iteritems to replace dictionary.iteritems() on python2 or dictionary.items() on python3. Change-Id: I972f065414e22d287bd7e00ab2c6e754f17afb75 Signed-off-by: Chuck Short <chuck.short@canonical.com>
* Decode the non-english username str to unicodeYangLei2013-09-061-0/+2
| | | | | | | | | convert the non-english username str to unicode, then the converted username can match the username from db. Fixes bug #1221576 Change-Id: I9e5f941fe43f081d75750e3f4754e8beea8210db
* Fixing potential NameErrorsMorgan Fainberg2013-08-301-1/+1
| | | | | | | | | | Fixing a couple locations that could potentially raise NameErrors instead of intended exceptions. These were found by looking at flake8 F821 (undefined name) errors. Added in unit tests to verify NameErrors would not be raised. Change-Id: I8619cb0be495b814335a5aea23daca025484d3c6
* Merge "Fix License Headers and Enable Gating on H102"Jenkins2013-08-291-0/+14
|\
| * Fix License Headers and Enable Gating on H102Morgan Fainberg2013-08-271-0/+14
| | | | | | | | | | | | | | | | Add ASLv2 headers to files that were missing it. fixes bug #1211587 Change-Id: Iede918e1ce84993cee4ecbb2d9c2606627fa412e
* | remove the UUID check for useridsMichael Solberg2013-08-271-4/+2
|/ | | | | Change-Id: I548d8ea292f737a6b5b0dddd8271a0cf690392a0 Fixes: bug #1189933
* Fix and enable Gating on H404Dirk Mueller2013-08-151-7/+6
| | | | | | | Enable gating on the Hacking H404 check - docstring should start with a summary. Change-Id: I80612a15bd11f689e9e9f4dc2ff812138630ddbd
* Fix and enable gating on H402Dirk Mueller2013-07-121-1/+1
| | | | | | Docstring summaries need punctuation. Change-Id: I1b740c13d5fedf9a625ca0807c908f651ee08406
* Use Python 3.x compatible print syntaxDirk Mueller2013-06-231-2/+2
| | | | | | | | Adding an extra pair of braces helps here to let Python 3.x interpret it as print function, while not confusing the Python 2.x print operator. Change-Id: I05af267ecfbcc80753726743fdf82c330350afcb
* Merge "Allow secure user password update."Jenkins2013-05-211-1/+22
|\
| * Allow secure user password update.Pradeep Kilambi2013-05-201-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | This patch allows the ability for user password to be updated via a command prompt so the password doesnt show up in the bash history. The prompted password is asked twice to verify the match. If user cntl-D's the prompt a message appears suggesting user to use either of the options to update the password. Fixes: bug#938315 Change-Id: I4271ae569b922f33c34f9b015a7ee6f760414e39
* | Restore compatibility with PrettyTable < 0.7.2Dirk Mueller2013-04-291-2/+4
|/ | | | | | | | PrettyTable 0.7.2 defaults to print a table even if the resultset is empty. Restore previous behavior to be in line with older prettytable releases. Change-Id: Idd1d0c2c2f41966076517cbc8819ba9a5e097306
* Add name arguments to keystone command.Ken'ichi Ohmichi2013-01-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | This patch adds name arguments to the following subcommands: * role-delete * role-get * service-delete * service-get * tenant-delete * tenant-get * tenant-update * user-delete * user-get * user-password-update * user-role-add * user-role-list * user-role-remove * user-update Fixes bug 1100648 Change-Id: I73c08c0ba553a72ec57ff3a684a00be4ef1294a6
* Fix keystoneclient user-list output orderMasayuki Igawa2012-12-111-2/+4
| | | | | | | | | | | | keystone user-list output is ordered by 'id' now. But this order(by 'id') is not human-friendly. Sorting by 'name' is easy to identify a user. This patch fixes this problem. Fixes bug 1073437 Change-Id: I00b1f46c248544157e09b2efccfff63a1f0426aa
* Add auth-token code to keystoneclient, along with supporting filesHenry Nash2012-11-121-0/+7
| | | | | | | | | | | | | | | This step in the process duplicates the auth-token code to keystoneclient but, for the moment, leaves a copy in its origional location in keystone. Testing for auth-token is also copied across, as is the cms support file. Although no other project will yet pick up the code here in the client, since the paste.ini files haev not yet been updated, it would work if anyone did reference it. Once the client code is in, the next step is to update all the other project paste files, and then finally retire the code from keystone. Change-Id: I88853a373d406020d54b61cba5a5e887380e3b3e
* Merge "updating keystoneclient doc theme"Jenkins2012-10-011-2/+3
|\