186 Commits

Author SHA1 Message Date
Terry Howe
033f27fe4d Add ability to prompt for passwords for user create and set
* Add get_password method to the utilities
* Add --password-prompt option
* Call the get_password method if a prompt is requested
* Various tests

Change-Id: I1786ad531e2a2fbcc21b8bc86aac0ccd7985995a
Closes-Bug: 1100116
2014-02-21 14:42:22 -07:00
Cyril Roelandt
5f9e7d09cb Python 3: the content of a FakeResponse must be bytes
Encode '_content' if necessary.

Change-Id: I25c1e1cd5330f0519bf062be840045d0ef520b28
2014-02-18 00:49:10 +01:00
Jenkins
e068cd0d71 Merge "FakeResponse: use a default status code" 2014-02-11 21:35:55 +00:00
Jenkins
c8354b8d83 Merge "Fix misspellings in python openstackclient" 2014-02-11 18:44:30 +00:00
Cyril Roelandt
9dc3eb5b18 FakeResponse: use a default status code
When running some tests from test_restapi.py, the following error happens:

    TypeError: unorderable types: NoneType() < int()

In Python 2, comparing NoneType and integers is possible:

    >>> None < 2
    True

But in Python 3, it's not allowed. Fix this by using a default status code.

Change-Id: Ic0fad5c68f3bf2dd8a2b98423549903f982192c9
2014-02-11 17:31:37 +01:00
Cyril Roelandt
3a5abf743c Use six.iteritems() rather than dict.iteritems()
This is compatible with both Python 2 and 3.

Change-Id: I6fe3e9bf9ece699badbdb9933118af90642a91e9
2014-02-11 02:53:24 +01:00
Shane Wang
8aa0b07fbc Fix misspellings in python openstackclient
Fix misspellings detected by:
* pip install misspellings
* git ls-files | grep -v locale | misspellings -f -

Change-Id: Ic0d3efa26eb9a05ce16a8319c142f5bd1ce23821
Closes-Bug: #1257295
2014-02-07 13:26:48 +08:00
Qiu Yu
a8d828f330 Add token create subcommand for identity v3 api
Implements token create subcommand which is an equivalent of keystone
token-get command. Original "wrap" parameter for keystone token-get is
not implemented yet due to cliff Bug #1269299

This is a part of: blueprint add-identity-token-support

Change-Id: I2255021c9d1f10f757686583b1ebe40b5f3a9ecb
2014-01-29 15:59:12 +08:00
Jenkins
cb2fd0af83 Merge "Remove copyright from empty files" 2014-01-23 17:38:15 +00:00
Alexander Ignatov
ad4367839f Remove copyright from empty files
According to policy change in HACKING:
http://docs.openstack.org/developer/hacking/#openstack-licensing
empty files should no longer contain copyright notices.

Change-Id: Iba09a00f24dfbd1cd03c1c9f70ea216788e64d93
Closes-Bug: #1262424
2014-01-20 17:28:13 +04:00
Qiu Yu
4848d3ca3a Add token create subcommand for identity v2 api
Implements token create subcommand which is an equivalent of keystone
token-get command. Original "wrap" parameter for keystone token-get is
not implemented yet due to cliff Bug #1269299

This is a part of: blueprint add-identity-token-support

Change-Id: I9e4de93306f2f5959717b5219621da03961524d8
2014-01-17 17:42:01 +08:00
Paul Belanger
420b10ee6d Add support for specifying custom domains
Add the ability to pass user_domain_id / user_domain_name, domain_id
/ domain_name, and project_domain_id / project_domain_name to keystone.
These parameters are the first step needed to getting multi-domain
support working via the CLI.

Closes-Bug: #1198171
Change-Id: I81a8534913978ff1cce01ec02741ae477e8c5fa4
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
Signed-off-by: Bo Tang <btang@cs.utsa.edu>
2014-01-07 16:50:20 -06:00
Jenkins
facdc8704e Merge "Bring RESTApi closer to ithe imminent keystoneclient.Session" 2013-12-06 22:48:29 +00:00
Jenkins
b88a7b8ccc Merge "Add module list command" 2013-12-05 23:34:31 +00:00
Dean Troyer
a93cc3fae2 Add module list command
Lists versions of installed python modules

(Origianlly proposed as 'version list')

Change-Id: I76a51d3d6783f46ef2daa0a41626019a880a2a50
2013-12-03 17:53:55 -06:00
Dean Troyer
74a27056b3 Update OSC's CommandManager subclass
cliff.commandmanager.CommandManager gained an option, update
openstackclient.common.commandmanager.ComamndManager to match.

Also add CommandManager.get_command_groups() to return a list of the
currently loaded command groups.  I expect this to be useful in
upcoming client diagnostic commands for plugins/extensions.

If these turn out to be generally useful we'll propose them to
upstream cliff.

Change-Id: Ic15a7ca0ef975ca679e753be861be7c628b8e10c
2013-12-03 17:40:54 -06:00
Dean Troyer
f2dbe2e437 Bring RESTApi closer to ithe imminent keystoneclient.Session
Prepare to use the (soon to be) common Session from keystoneclient
* Rework RESTApi to eventually be a subclass of keystoneclient.Session

Change-Id: I68e610f8b19a3f6267a93f7bf3de54a228be68aa
2013-12-03 14:26:46 -06:00
Dean Troyer
935781fdf9 Restore Object API name 'object-store'
It's used in the service catalog, doh!

Change-Id: If8f6db49c84756fd8e58cc68910160da4cd99b5d
2013-11-25 14:46:57 -06:00
Dean Troyer
9062811d10 Expand support for command extensions
Allows client libraries to have complete access to the rest of the
OSC ClientManager.  In addition, extension libraries can define
global options (for API version options/env vars) and define
versioned API entry points similar to the in-repo commands.

The changes to ClientManager exposed some issues in the existing
object api tests that needed to be cleaned up.

Change-Id: Ic9662edf34c5dd130a2f1a69d2454adefc1f8a95
2013-11-21 01:27:10 -06:00
Dean Troyer
200ed62054 Add server image create command
Translation of 'nova image-create', with tests!

Change-Id: I8a833aeff6f291e4774063ed235876eb2ba9c13c
2013-11-18 23:40:11 -06:00
Dean Troyer
6460f1eb35 Complete basic test infrastructure
This finally gets all of the API tests into a common framework regarding
test classes and so forth.

Change-Id: If675347129c50dcba0bfc5b6c58f5a2ca57ff46c
2013-11-18 22:11:10 -06:00
Dean Troyer
9137cc304d Do lookups for user, project in volume create
This required https://review.openstack.org/26323 in keystoneclient,
merged long ago...

Also adds some tests for 'volume create'

Change-Id: I55bededbc20b5dcf2833c59eb2b6b069703d8a9a
2013-10-25 12:21:41 -05:00
Jenkins
b3fd6ad6db Merge "Add to clientmanager tests" 2013-10-13 04:56:22 +00:00
Dean Troyer
ad59b03be6 Add object-store show commands
* Add lib.container.show_container() and lib.object.show_object()
* Add container and object show commands

Change-Id: I963d664c55b59739453345f0f353aa2eaf1bf70e
2013-09-26 13:34:11 -05:00
Dean Troyer
8898e020fb Identity v3 tests
* Add project, user, role and service v3 tests
* Fix issues in commands with enable/disable
* Make commands and tests more consistent between versions
* Make formatting and comments more consistent

Change-Id: Id21e7a5abd7e421a7742f937861ec46b53095fc7
2013-09-09 14:58:28 -05:00
Dean Troyer
7a0a7d67ed Prepare for Identity v3 tests
* Split identity/fakes.py for v2_0 and v3
* Split identity/test_identity.py for v2_0 and v3
* Fix issues in commands with enable/disable
* Clean up v2 commands

Change-Id: I6e536b6a130fc556dbd7dcf9f2e76d939ca1bc1c
2013-09-09 14:52:50 -05:00
Dean Troyer
916bb68dfd Add to clientmanager tests
Change-Id: Iea59c494f31de9c3e1d662f89e6e2babcc8fbd61
2013-09-05 12:54:14 -05:00
Dean Troyer
44c97cc099 Add Identity v2 role and service tests
* Add current auth info (auth_ref) to ClientManager
* Fix identity.v2_0.role.ListUserRole to get default user/project
  from ClientManager.auth_ref
* Fix identity.v2_0.role.AddRole call to roles.add_user_role()

Change-Id: Ie8bf41c491d97b0292a2b86bdc9b7580989a7f97
2013-09-04 21:37:45 +00:00
Dean Troyer
eb405a88c4 Refactor fake data for projects and users
* Move fake data structures into tests/identity/fakes.py
* Use fake clients correctly and support multiple client versions

Change-Id: Icacbb2ca740b63937bd2c4442af61b620638b53e
2013-09-04 14:48:24 -05:00
Dean Troyer
725e2543ef Object API commands using our REST API layer
* Add object-store API to ClientManager
* Add object-store client
* Add Object API library in openstackclient.object.v1.lib
* Add Object API {container,object} list commands
* Add library tests
* Add command tests

This should complete the Object v1 container and object list commands

Change-Id: Ib1770d45efa8871959826b85faafa1e0bcef0a03
2013-08-28 22:16:34 -05:00
Dean Troyer
17f13f7bf4 Create a new base REST API interface
* restapi module provides basic REST API support
  * uses dicts rather than Resource classes
  * JSON serialization/deserialization
  * log requests in 'curl' format
  * basic API boilerplate for create/delete/list/set/show verbs
* ignore H302 due to urllib import

Change-Id: I3cb91e44e631ee19e9f5dea19b6bac5d599d19ce
2013-08-23 12:08:32 -05:00
Dean Troyer
22a6e8891e Add Identity v2 user tests
* implement Identity command tests for v2 user

Also re-work the user create and set commands for exclusive options
(--enable|--disable) to actually behave properly.  Yay tests!

Change-Id: Ie1ec2569b3d85a9d556ee70f2e8f69fd2a3c03c8
2013-08-19 15:26:51 -05:00
Dean Troyer
493339d4da Add Identity v2 project tests
* establish the the form of cliff command classes
* implement some common fake objects
* implement Identity command tests for v2 project
* fix stdout/stderr capture

Also re-work the project create and set commands for exclusive options
(--enable|--disable) to actually behave properly.  Yay tests!

Change-Id: Icbb313db544c1f8dd3c9af7709971838b5a4d115
2013-08-16 14:35:46 -05:00
Dean Troyer
0aa3c206a3 Remove tenant round 1 - global options
Change the global auth options to use 'project', leave the original
tenant options in place but silent for compatability with the existing
project CLI auth options.  This is the only compatibility for tenant
usage in this changeover.

Change-Id: I3cce6e552f18822cc9f445ec5f301b0f5d9003f8
2013-07-31 10:07:50 -05:00
Dean Troyer
cdaee1b71e Complete Image v1
* Add v1 versions of image delete, list, save, set, show
* Change default Image API to v1

Rebased for https://review.openstack.org/#/c/36772/

Change-Id: Ie2bfe660aac8a0fcf651c67fd1ea4842e76ce377
2013-07-18 14:14:14 -05:00
Monty Taylor
196daf859b Move tests into project package.
There are several reasons for this. One is that the majority of
OpenStack packages behave this way. The second is that it makes writing
software that extends something easier to test (which is a clear usecase
for openstackclient) And third, tests/__init__.py implies a global
package named "tests" - which I'm pretty sure we're not providing.

Change-Id: Ic708ffd92aea78c2ffc1a8579af0587af4fca4ff
2013-06-30 23:30:54 -04:00