36 Commits

Author SHA1 Message Date
Dean Troyer
6357202971 Fix foundation copyrights
The OpenStack LLC copyrights date from before OpenStack was transferred
to the foundation.  These appear to be getting copy-pasted to new files
so at least should reflect the correct entity.

Change-Id: I02953d752cb24ead6aa4ad8bfe257a48317c9f13
2016-06-14 09:49:28 -05:00
Dean Troyer
530fe42589 Rename --profile to --os-profile
* The --profile global option is deprecated but will be supported
  through at least April 2017.
* Update man page

Closes-bug: #1571812
Change-Id: I2e623411a56096b4cc352f4eedbf770632ae2cc3
2016-04-19 07:50:42 -05:00
Jenkins
0edab95fd1 Merge "Support client certificate/key" 2016-04-06 21:42:56 +00:00
Cedric Brandily
3a8320a1d7 Support client certificate/key
This change enables to specify a client certificate/key with:
 * usual CLI options (--os-cert/--os-key)
 * usual environment variables ($OS_CERT/$OS_KEY)
 * os-client-config

Change-Id: Ibeaaa5897ae37b37c1e91f3e47076e4e8e4a8ded
Closes-Bug: #1565112
2016-04-06 20:21:19 +02:00
Cedric Brandily
bad21594be Use fixtures and addCleanup instead of tearDown
Nothing ensures tearDown call as tearDown is called only if test
succeeds. This change replaces tearDown use with:

* addCleanup use to stop mocks
* EnvFixture which ensures to unmock environment thanks to useFixture.

Change-Id: I1ff422e6a7585bc48b04b8f5c4cc1e7e9ddab1bc
2016-04-05 17:57:55 +02:00
Jenkins
2819450be5 Merge "Add shell --profile option to trigger osprofiler from CLI" 2016-02-26 19:49:21 +00:00
Dina Belova
16f00833a7 Add shell --profile option to trigger osprofiler from CLI
This will allow to trigger profiling of various services that
allow it currently and which APIs support is added to openstackclient.
Cinder and Glance have osprofiler support already, Nova and Keystone
are in progress.

To use this functionality osprofiler (and its storage backend) needs
to be installed in the environment. If so, you will be able to trigger
profiling via the following command, for example:

$ openstack --profile SECRET_KEY user list

At the end of output there will be message with <trace_id>, and
to plot nice HTML graphs the following command should be used:

$ osprofiler trace show <trace_id> --html --out result.html

Related Keystone change: https://review.openstack.org/#/c/103368/
Related Nova change: https://review.openstack.org/#/c/254703/

The similar change to the keystoneclient
(https://review.openstack.org/#/c/255308/) was abandoned as new
CLI extenstions are not more accepted to python-keystoneclient.

Change-Id: I3d6ac613e5da70619d0a4781e5d066fde073b407
2016-02-25 20:13:27 +00:00
Brandon Palm
f49f0fead2 Fixed a bunch of spacing
Nothing too complicated here.  I fixed a bunch of spacing issues
that I saw in OSC.

Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
2016-02-23 10:38:58 -06:00
Brandon Palm
11a8f911af Use instanceof instead of type
Adjusted conditional statements to use instanceof when
comparing variables. Instanceof supports inheritance type
checking better than type.

Change-Id: I4ee0004934dc2322d43ef07e797a6811e39a812c
Closes-Bug: 1548530
2016-02-22 16:23:23 -06:00
Richard Theis
d1311f9742 Add all regions to cloud configuration
OCC now requires all regions to be listed in the cloud
configuration. Update the shell unit tests to list all
of the regions being tested.

Change-Id: Ic7300d1f708339701b5daadbf2c4769b239a2adb
Closes-Bug: #1528926
2015-12-23 12:48:45 -06:00
Jenkins
46696f5ed5 Merge "Create log configuration class" 2015-09-09 20:15:54 +00:00
Jenkins
24ca952eb6 Merge "Set up every time record log in file" 2015-09-08 20:22:24 +00:00
TerryHowe
85a03945f0 Create log configuration class
Configuration of logging gets triggered twice.  The first time it
uses the CLI options when the application is started and second
it uses the configuration file after that is read.  The state of
the logging needs to be saved from the first to the second time,
so I created a class.

Implements: blueprint logging-migration

Change-Id: I7b8d1a3b6fd128e98cafd7c16009c7b694a52146
2015-08-26 10:23:53 +00:00
Daisuke Fujita
e23dd6de58 Set up every time record log in file
This will allow users to record logs of all their commands into
a predefined log file, in clouds.yaml. The log should have a
format similar to that of oslo.log.

Change-Id: I1b334bf429d575fc25809c9706fc0b11116be3f1
Implements: blueprint every-time-record-log-in-file
2015-08-08 10:02:46 -06:00
TerryHowe
b3335b3474 Do not set default versions in parsed args
Setting default versions in parsed args makes it so OCC
cannot tell if the argument was parsed, an environment
variable was set or it is just defaulted.  In order to
set api versions from OCC, it will have to be defaulted
after processing OCC.

Closes-Bug: #1453229
Change-Id: I4d065919397b783f3bdd4022c986c0234a7a16e6
2015-07-18 06:28:09 -06:00
Jenkins
bbe71eb9a3 Merge "Rename endpoint type to interface" 2015-07-17 13:55:47 +00:00
TerryHowe
36391a81a3 Rename endpoint type to interface
Change-Id: I4e21d09bc747e8210f4f79a1d6c4c7ccf2f25d1c
Closes-Bug: #1454392
2015-07-15 10:11:59 -06:00
Steve Martinelli
79c69e1e82 temporarily skip help tests
We're trying to change cliff for the better, by improving the UX
of the help command. But cliff tests against the tip of OSC.

Temporarily skip the tests that are failing and then update them
once the fix for cliff has been merged.

The patch in question: https://review.openstack.org/#/c/201258/

Change-Id: Ie1e7ddd66477ddf4a3bafedad12934e900ace48f
2015-07-13 22:59:15 -04:00
Roxana Gherle
5521e4c504 Add --os-endpoint-type cli optional argument
User should be able to specify the endpoint type through
a CLI optional argument/ENV variable setting. We will name this new
optional argument: --os-endpoint-type (Env: OS_ENDPOINT_TYPE) and
based on the value given, the service API will use that specific
endpoint type. Possible values: public, admin, internal.

DocImpact
Closes-Bug: #1454392
Change-Id: Ife3d4e46b44c0ddcd712b1130e27e362545a9a29
2015-07-02 10:10:46 -07:00
Dean Troyer
31d785ec69 Allow --insecure to override --os-cacert
Change --insecure to ignore the --os-cacert setting.  This is a change
from before where OSC followed the requests pattern of cacert taking
priority.

This logic is also introduced in os-client-config 1.3.0; we
do not require that release yet so it is duplicated here for now.
That change will come with the upcoming global options refactor.

Closes-Bug: #1447784
Change-Id: Iaa6d499ed0929c00a56dcd92a2017487c702774a
2015-06-04 09:37:46 -05:00
Dean Troyer
a05cbf4c99 Rework shell tests
This is the first step in reworking the shell argument handling,
clean up and add tests to ensure functionality doesn't change.

* Rework shell tests to break down global options and auth options.
* Make tests table-driven
* Remove 'os_' from 'cacert' and 'default_domain' internal option names

Change-Id: Icf69c7e84f3f44b366fe64b6bbf4e3fe958eb302
2015-06-02 09:49:17 -05:00
Dean Troyer
2c4b87869b Add cli tests for --verify and friends
The tests that will change after the verify-always-true bug is fixed
are currently commented out.  The commented asserts show where we
want to go.

Also fixes --verify parser value

Change-Id: I891e3ead5fc3da3ed2ecba5d2befd9e910778655
2015-05-28 18:01:49 -05:00
TerryHowe
211c14c638 Fix shell tests
Personally, I think these tests should be removed, they are
testing OCC.  An internal OCC change on a private method broke
this test.

Change-Id: I760bf90ef8bd97e30be7838874337be695d45285
2015-05-28 11:01:13 -06:00
Dean Troyer
90705f191e Add os-client-config cli tests
Add tests for --os-cloud handling and precedence between CLI,
env vars and clouds.yaml.

Change-Id: I91d96f483d395f19ffcf74ec0187718ba01a1c41
2015-05-01 17:44:57 -05:00
Dean Troyer
5649695c65 Add --os-cloud support
This adds a new option --os-cloud that allows the configuration values
for multiple clouds to be stored in a local file and selected with
a single option.

Internal option names have had 'os_' removed to be comptible with
the options returned from OpenStackConfig().get_one_cloud().

The config file is ~/.config/openstack/clouds.yaml:

Sample
------
clouds:
  devstack:
    auth:
      auth_url: http://192.168.122.10:35357/
      project_name: demo
      username: demo
      password: 0penstack
    region_name: RegionOne
  devstack:
     auth:
       auth_url: http://192.168.122.10:35357/
       project_name: demo
       username: demo
       password: 0penstack
     region_name: RegionOne

Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Change-Id: I4939acf8067e44ffe06a2e26fc28f1adf8985b7d
Depends-On: I45e2550af58aee616ca168d20a557077beeab007
2015-04-18 23:04:51 -05:00
wanghong
127af151ff fix the wrong order of assertEqual args
Let's fix them thoroughly.

Change-Id: I8a1f042fb614b05c9836a49041f3883638b870b0
2015-01-27 17:02:41 +08:00
Dean Troyer
2b02beaa51 Liberalize version matching a bit
For class-loading purposes we can just use the major version,
so accept that. Only Identity and Compute were affected; Compute
is included just to be pedantically complete.

For command groups we also just use the major version so fix
Compute and the version option handling.

Change the internal default for Identity to a simple '2' so it
is also consistent with the rest of the world.

Then comes microversioning...

Closes-Bug: #1292638
Change-Id: Ibaf823b31caa288a83de38d2c258860b128b87d8
2014-11-16 11:37:52 -06:00
Dean Troyer
f079b5b9c4 Change --os-auth-plugin to --os-auth-type
User's don't know what a plugin is.

* Internally, os_auth_type and/or auth_type represents what the
  user supplied.
* auth_plugin_name is the name of the selected plugin
* auth_plugin is the actual plugin object

Plugin selection process:
* if --os-auth-type is supplied:
  * if it matches against an available plugin, done
  * (if it can map to an availble plugin type, done; TODO in a followup)
* if --os-auth-type is not supplied:
  * if --os-url and --os-token are supplied, select 'token_endpoint'
  * if --os-username supplied, select identity_api_version + 'password'
  * if --os-token supplied, select identity_api_version + 'token'

Change-Id: Ice4535214e311ebf924087cf77f6d84d76f5f3ee
2014-10-23 15:37:44 -05:00
Matthieu Huin
0c77a9fe8b Support for keystone auth plugins
This patch allows the user to choose which authentication plugin
to use with the CLI. The arguments needed by the auth plugins are
automatically added to the argument parser. Some examples with
the currently available authentication plugins::

  OS_USERNAME=admin OS_PROJECT_NAME=admin OS_AUTH_URL=http://keystone:5000/v2.0 \
  OS_PASSWORD=admin openstack user list

  OS_USERNAME=admin OS_PROJECT_DOMAIN_NAME=default OS_USER_DOMAIN_NAME=default \
  OS_PROJECT_NAME=admin OS_AUTH_URL=http://keystone:5000/v3 OS_PASSWORD=admin \
  OS_IDENTITY_API_VERSION=3 OS_AUTH_PLUGIN=v3password openstack project list

  OS_TOKEN=1234 OS_URL=http://service_url:35357/v2.0 \
  OS_IDENTITY_API_VERSION=2.0 openstack user list

The --os-auth-plugin option can be omitted; if so the CLI will attempt to
guess which plugin to use from the other options.

Change-Id: I330c20ddb8d96b3a4287c68b57c36c4a0f869669
Co-Authored-By: Florent Flament <florent.flament-ext@cloudwatt.com>
2014-10-09 12:34:47 +02:00
Terry Howe
b157dc937e Move network stuff to v2 instead of v2_0
Rename network stuff v2

Change-Id: Ia9b8feda20dfd35b0f3712b8e2419d0bf5da0acd
2014-07-07 06:08:02 -06:00
Matthieu Huin
5672c688d1 trust authentication
This patch enables authenticating by using a trust. The trust ID
must be set with the parameter --os-trust-id or the env variable
OS_TRUST_ID. Trusts are available for the identity v3 API.

Co-Authored-By: Florent Flament <florent.flament@cloudwatt.com>
Change-Id: Iacc389b203bbadda53ca31a7f5a9b8b6e1a1f522
2014-07-03 10:12:02 +02:00
Terry Howe
8f59524c3e Network CRUD
bp/neutron
https://wiki.openstack.org/wiki/OpenStackClient/Commands#Network_2

Change-Id: I89ee083154afa544b03587e84becace36d9d522a
2014-06-24 15:00:25 -06: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
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