62 Commits

Author SHA1 Message Date
Aarni Koskela
1833d5bb5c Remove six dependency
This client hasn't been compatible with Python 2 in years,
so there is no point depending on a Python 2/Python 3
compatibility library.

Change-Id: I6979fcf0f92408751d9c3df937c8d4c060cfff54
2023-12-20 15:43:57 +02:00
Monty Taylor
f0c9b20e0f
Handle UTC+00:00 in datetime strings
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
2017-12-02 11:15:26 -06:00
Morgan Fainberg
4a43aa02b8 Remove use of positional decorator
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
2017-08-07 13:14:55 -07:00
zlyqqq
683c469b2f Remove unused log
Change-Id: I1fe2c1703b03eb1c8458c53bdd208a91ababf941
2017-04-25 17:22:09 +08:00
Jenkins
228d9b7810 Merge "Remove unauthenticated functions" 2016-11-10 14:20:18 +00:00
Jamie Lennox
5242c2371b Remove unauthenticated functions
These were used by the shell which has since been removed.

Change-Id: If329da4499b76799356e79099f86a4afdebb00ce
2016-08-24 18:56:23 +10:00
Jamie Lennox
5b91fedd65 Use exceptions from Keystoneauth
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
2016-08-24 18:52:36 +10:00
Navid Pustchi
bca112c8ba Fixing D202 and D203 PEP257 violation.
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
2016-05-04 19:45:30 +00:00
Navid Pustchi
20e23f3e0d Fix D400 PEP257 violation.
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
2016-04-23 17:47:25 +00:00
Navid Pustchi
946e928b52 Fix D401 PEP257 violation.
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
2016-04-23 06:25:20 +00:00
Christopher J Schaefer
dbf4f31646 Removing bandit.yaml in favor of defaults
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
2016-04-19 10:35:00 -05:00
Steve Martinelli
ef13bd8cf6 remove CLI from keystoneclient
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
2016-03-10 03:51:01 +00:00
Steve Martinelli
81fdaabf3f use positional library instead of utils
swap instances of utils.positional with the positional library.

Change-Id: Id8a9961e68d287a802f25512fc970829e9feb5c2
2016-01-25 01:54:35 -05:00
Morgan Fainberg
056740cd2d Use positional library instead of local code
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
2016-01-23 11:46:41 -08:00
lin-hua-cheng
77ed0d4d0c Address hacking check H405
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
2016-01-13 13:03:51 -08:00
Brant Knudson
225832f591 Switch from deprecated oslo_utils.timeutils.strtime
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
2015-06-30 12:58:55 -05:00
Brant Knudson
97c2c690d8 Switch from deprecated isotime
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
2015-06-30 12:58:55 -05:00
Brant Knudson
c0046d7d01 Stop using function deprecated in Python 3
Python 3 deprecated the logger.warn method in favor of warning.

 DeprecationWarning: The 'warn' method is deprecated, use 'warning'
 instead

Change-Id: Idbd4de3c7c631fb2c235701c9b300c37a90d9538
2015-06-08 20:29:07 -05:00
Jamie Lennox
17d51f771e Prompt for password on CLI if not provided
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
2015-05-02 14:09:22 +10:00
Brant Knudson
ab09d3eb5f Switch from oslo.utils to oslo_utils
oslo_utils moved out of the oslo namespace.

bp drop-namespace-packages

Change-Id: I72e67dc1f649ba137dd06f5ab7133858c6abd67d
2015-01-31 08:03:37 -06:00
Steve Martinelli
802301ca17 Use oslo.utils and oslo.serialization
Left timeutils and strutils in openstack/common since they are used in
openstack/common/apiclient and memorycache.

Change-Id: Idb5f09c159d907dfba84cd1f7501f650318af7d9
2014-10-15 04:25:50 +00:00
Matt Riedemann
181a466245 Revert "Use oslo.utils"
This reverts commit 68c2fad55a71ca511ff959e589aa0a3f3dbd4b78.

Looks like this broke the stable branches. :(

Change-Id: I9d190e211ecfa80d573a6c48c0b485f3506fe947
Closes-Bug: #1357652
2014-08-17 13:52:12 -07:00
Brant Knudson
68c2fad55a Use oslo.utils
keystoneclient was using utility function from oslo-incubator
rather than oslo.utils.

Change-Id: I2909a2150b9556e54ef88e72358fda1cf8b7cc1c
2014-08-05 18:01:54 -05:00
Brant Knudson
4b36da79f1 Fix tests to use UUID strings rather than ints for IDs
Several tests were using ints rather than strings for IDs. The ints
were changed to UUID strings.

Change-Id: I65312509c72078c08ca284e313104e926d9885ba
2014-06-02 08:59:24 -05:00
Brant Knudson
b4f346749b Sync with oslo-incubator 2640847
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
2014-05-05 19:41:23 -05:00
Christian Berendt
b530800649 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I67fb3e0d02c931cb7e605ac74ea8272956afa8e1
2014-05-03 09:54:39 +02:00
Brant Knudson
82359492dc Hash functions support different hash algorithms
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
2014-04-09 13:54:30 -05:00
Jamie Lennox
67e99991d5 Add a positional decorator
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
2014-03-24 09:49:10 +10:00
Jenkins
8b0c5eea3c Merge "Using common method 'bool_from_string' from oslo strutils" 2014-02-13 14:41:23 +00:00
Eric Guo
d6d0d66374 Remove vim header
We don't need vim modelines in each source file, it can be set in
user's vimrc.

Change-Id: Ic7a61430a0a320ce6b0c4518d9f5d988e35f8aae
Closes-Bug: #1229324
2014-02-08 22:22:08 +08:00
llg8212
a7a55cb652 Using common method 'bool_from_string' from oslo strutils
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
2014-01-22 14:50:57 +08:00
Cyril Roelandt
f9e3b7adc9 Do not try to call decode() on a text string
This fixes a call to 'isinstance' that only worked on Python2.

Closes-Bug: #1265879
Change-Id: I886da95f1ad2a8314de92be8aecb354ee3124e6d
2014-01-03 19:14:30 +01:00
Jenkins
81460b55fe Merge "Fix typo in keystoneclient" 2013-12-03 03:54:45 +00:00
huangtianhua
272fb6ac78 Fix typo in keystoneclient
hypen-separated --> hyphen-separated
initialzied --> initialized
did't --> didn't
sematics --> semantics

Change-Id: I79841b76fdf7a267e325b8b9d917900ccb393c02
Closes-Bug: #1254660
2013-11-25 18:30:28 +08:00
Lei Zhang
98231f6ccd Encode the text before print it to console
Closes-Bug: #1250490
Change-Id: I516806a0f8a136bb66c64dcdcd07cee6d297e619
2013-11-25 12:02:40 +08:00
Chuck Short
b7b31bf646 python3: Make iteritems py3k compat
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>
2013-10-10 14:07:20 -04:00
YangLei
54ff072956 Decode the non-english username str to unicode
convert the non-english username str to unicode,
then the converted username can match the username from db.

Fixes bug #1221576

Change-Id: I9e5f941fe43f081d75750e3f4754e8beea8210db
2013-09-06 18:06:55 +08:00
Morgan Fainberg
f9572140bc Fixing potential NameErrors
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
2013-08-30 01:15:57 +00:00
Jenkins
7719a14056 Merge "Fix License Headers and Enable Gating on H102" 2013-08-29 22:02:06 +00:00
Michael Solberg
1bd5b7328b remove the UUID check for userids
Change-Id: I548d8ea292f737a6b5b0dddd8271a0cf690392a0
Fixes: bug #1189933
2013-08-27 16:29:01 -04:00
Morgan Fainberg
35deb1ae1b Fix License Headers and Enable Gating on H102
Add ASLv2 headers to files that were missing it.

fixes bug #1211587

Change-Id: Iede918e1ce84993cee4ecbb2d9c2606627fa412e
2013-08-27 00:04:03 -07:00
Dirk Mueller
dc5c33a9e5 Fix and enable Gating on H404
Enable gating on the Hacking H404 check - docstring
should start with a summary.

Change-Id: I80612a15bd11f689e9e9f4dc2ff812138630ddbd
2013-08-15 20:35:35 -07:00
Dirk Mueller
f2ad113d1c Fix and enable gating on H402
Docstring summaries need punctuation.

Change-Id: I1b740c13d5fedf9a625ca0807c908f651ee08406
2013-07-12 09:36:07 +02:00
Dirk Mueller
f695342683 Use Python 3.x compatible print syntax
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
2013-06-23 18:14:43 +02:00
Jenkins
3f40509751 Merge "Allow secure user password update." 2013-05-21 00:08:41 +00:00
Pradeep Kilambi
f2e0818bc9 Allow secure user password update.
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
2013-05-20 14:02:16 -04:00
Dirk Mueller
2732fe098a Restore compatibility with PrettyTable < 0.7.2
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
2013-04-29 11:25:19 +02:00
Ken'ichi Ohmichi
9351665062 Add name arguments to keystone command.
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
2013-01-17 18:11:27 +09:00
Masayuki Igawa
45ab2e8db7 Fix keystoneclient user-list output order
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
2012-12-11 08:10:11 +09:00
Henry Nash
7920899af1 Add auth-token code to keystoneclient, along with supporting files
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
2012-11-12 19:40:21 +00:00