164 Commits

Author SHA1 Message Date
Joshua Harlow
9fd2c8a59d Allow request timeout to be specified.
Add a new cli argument (--timeout) which
is by default 600 seconds which will be
set in the requests library so that timeouts
can occur correctly.

Change-Id: I716ac15fe08f42c9464ee43010bc8fd2667bcbde
2013-01-16 17:57:56 -08:00
Dean Troyer
aa1df04bad Use requests module for HTTP/HTTPS
* Implement correct certificate verification
* Add --os-cacert
* Rework tests for requests

Pinned requests module to < 1.0 as 1.0.2 is now current in pipi
as of 17Dec2012.

Blueprint: tls-verify

Change-Id: I9a25a94c8dfcaf483c4c8328439809d65cf10b38
2012-12-20 13:04:46 -06:00
Vishvananda Ishaya
80a72e1a92 Makes the OS_NO_CACHE env variable work again
The commit to replace --os-no-cache with --os-no-cache works fine
with the cli options, but the env variable is stored in os_cache
which has the opposite of the intended effect. This patch converts
the variable to a bool and then inverts it before it stores it
in os_cache. This makes it work properly again.

Fixes bug 1089696

Change-Id: Iea12806603ecdc39c6475ad4d6f867ebb1e01633
2012-12-12 15:59:13 -08:00
Dan Prince
e483455a12 Adds --os-cache to replace old --no-cache.
Deprecates the old --no-cache option in favor of --os-cache.

The old CLI args (--no_cache and --no-cache) and ENV option
(OS_NO_CACHE) are still supported but no longer show up
in help.

The new option for --os-cache can also be set via the OS_CACHE ENV
variable... which now defaults to False. This should be much more user friendly.

Fixes LP Bug #1087776.

Change-Id: I3cea089c7e11ce75f22c2d7f3242b02b80441323
2012-12-11 12:58:37 -05:00
melwitt
aa5622147f discover extensions via entry points
Currently, nova client can only discover extensions in two ways:

1. Installing the extension in the novaclient/v1_1/contrib/ directory.
2. Installing the extension in the top-level python path or modifying
   the path to be picked up by pkgutils.iter_modules()

This patch allows a third, more flexible option of discovering
extensions via entry points. This means the extension can be
installed anywhere and entry points can be registered with python
to be picked up by pkg_resources.iter_entry_points().
To register an entry point, simply add the extension module to
the setup() call in setup.py like this:

setuptools.setup(
    name='mydistribution',
    packages=setuptools.find_packages(),
    entry_points={
        'novaclient.extension' : [
            'foo = mydistribution.mynovaclientexts.foo'
        ]
    },
)

Change-Id: Ic1e223a9173546131e742506897f585f4ac65767
2012-11-09 01:57:53 +00:00
Christian Berendt
4ad512b50e show help when calling without arguments
When calling nova without arguments you'll receive the following
output:

error: too few arguments
Try 'nova help ' for more information.

Changing 'and' to 'or' the help is also shown when calling nova
without arguments. I think that's the expected behavior.

Change-Id: Id14f0292ad00e6e45ad66dd010f449c3abbf3871
2012-11-08 22:46:26 +01:00
Eric Harney
5cdc584efd Add support for Unicode secgroup names
Fixes bug 934081.

Previously, manipulating secgroups with Unicode names would fail
in _get_secgroup, due to the command-line argument being a raw
byte string, and the secgroup name from cs.security_groups.list()
being a Unicode string.  This causes a UnicodeWarning and the
"if secgroup == s.name" test to fail for the desired secgroup, so
secgroup-add-rule and secgroup-delete would fail.

This change converts them to byte strings for comparison, fixing
these commands.

Likewise, error messages containing Unicode secgroup names would
fail to print. (i.e. "Security group <x> already exists")

Change-Id: Ie90cb49b8f11e3283fe509e95a8e9fd468cc9892
2012-09-13 15:14:40 -04:00
Jenkins
6de710fa18 Merge "Change '_' to '-' in options" 2012-08-27 20:22:56 +00:00
Dean Troyer
9101741960 Change '_' to '-' in options
This changes every command-line option with a '_' in its name
and changes them to '-'.  The old option names are maintained
for backward compatibility but are no longer in the help text.

BP command-options

Note: there is a dodgy hack in novaclient/shell.py to handle
usage-list's --end option that conflicts with --endpoint-type
if --endpoint_type is also present for backward compatibility.
If --endpoint_type is not added to the parser it works.  Go figure.
Better solutions that do not break backward compatibility are welcome.

Rebased due to https://review.openstack.org/11072 merging.
Note: --availability_zone changed to --availability-zone with no
backward compatability since this s a new option.

Change-Id: I09ab546659be0a0d3f0eadb22ab5e13fac2f059d
2012-08-24 15:22:44 -05:00
Rick Harris
b54330bfd2 Adding --version option
Change-Id: I7d37af1ddee186af22457baea9af71a955720053
2012-08-24 19:17:46 +00:00
Chmouel Boudjnah
86c713b17a Allow different auth providers via plugin system.
- Remove the NOVA_RAX_AUTH hack and provide (temporary) compatibility
  with the new system.
- Example plugin for RAX and HP provided here :
    RAX - https://github.com/emonty/rackspace-auth-openstack
    HP - https://github.com/emonty/hpcloud-auth-openstack
- Plugin are allowed to specify their own auth_url directly.
- Thanks to mtaylor for helping on this.

Change-Id: Ie96835be617c6a20d9c3fc3bd1536083aecfdc0b
2012-08-06 09:10:00 +02:00
Sascha Peilicke
186a38cbc6 Clarify usage of --insecure flag
Change-Id: Iad52212ea2ba7bfc93c597c23cc6314f9916edb9
2012-07-20 10:20:45 +02:00
Major Hayden
6483ad10a7 Bring back the output from client.http_log()
Change-Id: If7c583751abe9ae60f299515a5f7778db72fa70c
2012-07-02 15:42:02 -05:00
Jenkins
08cf0bf95e Merge "Indicate unused variables and other misc. house cleaning." 2012-06-29 16:48:19 +00:00
Sandy Walsh
1c6e044bdc Auth token caching on by default. --no_cache to disable. Better bypass support too.
Will use and/or store your Openstack Auth token in the operating
system's keyring if available. Cuts about a 1/2 second off operations.

Change-Id: Ibe2dc0c49baefd23afe3844a78c1df884a4fb7c7
2012-06-27 16:43:58 -03:00
Josh Kearney
d4c9b12f39 Indicate unused variables and other misc. house cleaning.
Change-Id: I4529d8b6b27dddb1b79ee2167a054b471eaf0dbc
2012-06-27 11:55:36 -05:00
Sandy Walsh
a2a62a5f71 option to bypass managment endpoint and timings support
--timings = show timings for each call made to nova (including auth)
--bypass_url = api node endpoint to use instead of one from service catalog

For example:
nova --timings --bypass_url=http://10.24.31.37:8774/v1.1/nova-staging boot --image f304d266-0a49-4877-b34c-63aea8360297 --flavor 3 delete_me_2

Change-Id: Ib2a258b7e969ad56ce4ee2bd64c61310278cb856
2012-06-18 13:03:58 -03:00
Chuck
636f32b00a refactored --service_name to only work with compute calls and added
--volume_service_name for volume calls

Change-Id: I2b1188fb57f9576daebfaceaddc6eea44a47b4ee
2012-05-09 11:11:38 -05:00
Christian Berendt
c36ac8b3d7 really output the description of an exception
example without patch:

nova [...] flavor-delete 123
ERROR:

example with this patch:

nova [...] flavor-delete 123
ERROR: Flavor 123 could not be found. (HTTP 404)

fixes bug 981286

Change-Id: I9c5cead521e48b4970850262fb9af279ec5a7753
2012-04-26 18:57:55 +02:00
Josh Kearney
765f551a26 Rename NOVA_VERSION to OS_COMPUTE_API_VERSION.
Fixes bug 940432.

Change-Id: I18187eb68d936632b4ae78676a0a9f062afba8f2
2012-04-13 10:48:05 -05:00
Adam Spiers
ad4a04a64e Make '--help' argument more useful.
With no other arguments, '--help' now outputs the same as 'help', so
that the list of subcommands are no longer omitted.  Additionally,
'$subcommand --help' now yields the same output as 'help $subcommand'.

Change-Id: Iabd926574e296ad14b622862b9fba038fdede66e
2012-04-11 15:35:27 +01:00
Andrew Bogott
565d144611 Fixed the subcommand error message for nova shell.
Previously we were giving advice like this:

"Try 'nova volume-show help' for more information."

Bad advice -- that doesn't work. Now when there's a subcommand
specified we make a proper suggestion:

"Try 'nova help volume-show' for more information."

Change-Id: I6ef49f9e4e1b67074f51ab442abd4a196d437b00
2012-04-10 15:01:53 -05:00
Pádraig Brady
97953f52e1 Improve the error message from the nova shell
Output 'nova help' on error rather than `nova'

Change-Id: I71c3fb6786472c42b0bfd93a085168ba75d37590
Old-Change-Id: I67360589a4af5697d3f90afa74b8504eefaf4976
2012-03-21 09:48:26 +00:00
Rick Harris
3d9a2284d3 Adds NOVACLIENT_INSECURE option.
Fixes bug 960704

Change-Id: I885fddaac57c113b66b4b71120c2a537fa391b09
2012-03-20 23:15:41 +00:00
Dean Troyer
cc72d6dfe2 Change CLIAuth arg names
Change the argument names used for common Keystone authentication per the
updated http://wiki.openstack.org/CLIAuth:

--auth_url -> --os_auth_url
--password -> --os_password
--username -> --os_username
--tenant_name -> os_tenant_name
--region_name -> os_region_name

All old args are depricated but available for backward compatibility.

Fixes bug 954531

Change-Id: Ic67c447e4e4b8d793f587c789cecd149446194f3
2012-03-14 12:30:38 -05:00
Vishvananda Ishaya
03f54c57e1 Makes novaclient use the volumes endpoint
* Depends on https://review.openstack.org/#change,4479
 * Adds support to change service type including tests
 * Adds decorator for methods that need to use another service type
 * Changes volume and snapshots to use the volume endpoint
 * These extensions will move into the volume client once it exists
 * Fixes bug 940017

Change-Id: I683e4ca6c67e278d8aa8a9acec3dc0f1872f43f2
2012-02-26 06:11:12 +00:00
Dave Walker (Daviey)
1ee77c7fe3 Allow UUID_CACHE_DIR overriding via env variable.
This is declared as NOVACLIENT_UUID_CACHE_DIR.
Resolves bug 932468 , defaulting to previous behaviour.
Added myself to AUTHORS

Change-Id: I154500517d7c882a4a090588a95f4b3bfee70595
2012-02-15 21:58:27 +00:00
Cole Robinson
5f89c8487d shell: Hook --debug up to more stuff
Particularly to pythons logging infrastructure, and to always print
a backtrace if the CLI throws an exception. Show --debug in the
help output since end users may certainly have legitimate reasons for
wanting debug output.

Change-Id: Icfdaaf5511db8eecbf650e7ef4437b342b560141
2012-02-13 16:43:11 -08:00
Dean Troyer
e2d869d1da Fixes bug 924588: Remove proto-keystone client from novaclient
Change-Id: Ib3f3b8bfdefe56a13889796948a0186309c9a313
2012-02-03 17:54:47 -06:00
Jenkins
3b01068312 Merge "moves the "help" in the usage information of a wrong command to the correct position" 2012-02-03 23:44:25 +00:00
Dean Troyer
3a3f2b4ff8 Blueprint cli-auth: common cli args
Depricate --apikey, --projectid, --url (though still present for
compatibility).  Fully support OS_* env vars per
http://wiki.openstack.org/CLIAuth Password Flow.

Fixes lp897304

Change-Id: I655631194ed62133c24f30c9114e6fdc0fa77636
2012-02-02 16:40:49 -06:00
Jenkins
9d4b854ff1 Merge "do not require NOVA_VERSION in env, default to 1.1" 2012-02-01 22:18:57 +00:00
Ziad Sawalha
38bc7ea570 Handle Ambiguous Endpoints Correctly
- Added --service_name argument to allow selecting
  endpoints by service name
- Renamed endpoint_name argument to endpoint_type (this breaks
  compatibility)
- Return AmbiguousEndpoints error if more than one endpoint
  matches filter
- Also addresses bug 924052

Use case:
  $ nova --projectid xxx --version 1.1 --password xxx --username xxx --url https://identity.openstackcloud.com/ image-list
  Found more than one valid endpoint. Use a more restrictive filter
  AmbiguousEndpoints: [
    {'serviceName': 'New Cloud', 'region': 'Test', 'publicURL': 'https://test.openstackcloud.com/v1.1/tttt', 'tenantId': 'tttt'},
    {'serviceName': 'Old Cloud', 'publicURL': 'https://servers.openstackcloud.com/v1.0/tttt', 'tenantId': 'tttt'}]

  $ nova --projectid tttt --version 1.1 --password xxx --username xxx --url https://identity.openstackcloud.com/ --service_name 'New Cloud' image-list
  +--------------------------------------+-----------------------------+--------+--------+
  |                  ID                  |             Name            | Status | Server |
  +--------------------------------------+-----------------------------+--------+--------+
  | 346f4039-a81e-4444-9223-4a3d13592a07 | Debian Squeeze (6.0)        | ACTIVE |        |
  | ac8985ea-c09e-4544-82af-eb459a02a6b2 | Fedora 15                   | ACTIVE |        |
  | ddddc02e-92fa-4f44-b36f-55b39bf66a67 | CentOS 5.6                  | ACTIVE |        |
  +--------------------------------------+-----------------------------+--------+--------+

Change-Id: I9a10b9ad5e5b9cf6e762659013496a93a79774db
2012-01-31 18:37:36 -06:00
Christian Berendt
0847282fd8 moves the "help" in the usage information of a wrong command to the correct position
fixes bug 922047

Change-Id: I9fdd76bd995a9bc4c469a8bcb47fe0e7f8a3d261
2012-01-26 13:36:39 +01:00
Scott Moser
9c6a1ac205 do not require NOVA_VERSION in env, default to 1.1
fixes bug 920474.

the nova client was not defaulting to version 1.1 unless NOVA_VERSION was
set.  This makes version 1.1 the default if NOVA_VERSION is not set in the
environment.

It also makes shell.py usable from a git checkout as in:
  PYTHONPATH=$PWD python novaclient/shell.py image-list

Change-Id: I02b7e060d1c0694639fcb146a7394b92014c140b
2012-01-23 13:31:10 -05:00
Rick Harris
149b248a27 Get ImpLoader from ImpImporter for Py2.6
Fixes bug 914476

Change-Id: I9fc8b89e66e8d8501262b3f93ce0b60470525426
2012-01-10 21:33:07 +00:00
Rick Harris
269d43a38d Discover extensions via Python's import paths
Change-Id: I0f3b216737fad26157b20f0cf75c78108e4cfdbc
2012-01-06 16:37:28 -06:00
Jenkins
4c61a89457 Merge "Abstract Client building into novaclient.client" 2012-01-04 16:45:47 +00:00
Julien Danjou
af7c33ec43 Fix typo in endpoint_name help string
Change-Id: Ibee3175b26af3eec033cdf2f35e49f268eef3796
Signed-off-by: Julien Danjou <julien.danjou@enovance.com>
2011-12-30 17:24:52 +01:00
Brian Waldon
e0174b51bd Abstract Client building into novaclient.client
This prevents clients of the pythonic api from having to know the
internal module structure.

Change-Id: Idd5c522ac3ff6c2d7915f96ed327323ec83d54fc
2011-12-29 15:40:49 -05:00
Rick Harris
88bdfdd12f Extensions can now modify resources.
Change-Id: I0d9c1050428d0ccf2e2b18053d75e0465463c08b
2011-12-21 19:25:39 +00:00
Jesse Andrews
68d0abb061 more work towards standardize config
Change-Id: I63ca85c56a61b8412bdc8bf30d6a179b134faff4
blueprint: cli-auth
2011-12-21 09:59:53 -08:00
Jenkins
450952b598 Merge "Add 'discover' command for Keystone discovery and version listing" 2011-12-20 18:54:57 +00:00
Ziad Sawalha
49284dc5cd Add 'discover' command for Keystone discovery and version listing
Added @unauthenticated decorator to mark subcommands that do not
need authentication. And checks to skip authentication for these
commands.
Added novaclient.keystone to setup.py

Change-Id: Id2fd60af305c30a950bdbae8f897192bfae4d797
2011-12-20 12:33:50 -06:00
lzyeval
487032ae07 User friendly help message
Fixes bug #892066

Change-Id: Ibeb86c5a9ae0f1dcc313c77fdf923a2eb37de505
2011-12-20 13:50:13 +08:00
Jesse Andrews
95f277a09f standardize environmental settings for cli auth
a first pass at common configuration between cli tools
https://blueprints.launchpad.net/openstack-common/+spec/cli-auth

Change-Id: Ie1354268ef647fb265ad9f30e730ddcac990e7f7
2011-12-16 00:11:02 -08:00
Rick Harris
3661be6673 Removed v1.0 support.
Change-Id: I6850075a2ac0e1558aa94539e73f4fb939dfb318
2011-12-15 23:10:59 +00:00
Rick Harris
b3f48f7064 Making contrib a Python package
Change-Id: Ibfde2e5cbececeec0b6a17f7d71da207f582a5c7
2011-12-15 22:39:22 +00:00
Rick Harris
bb879dd10b Adding extension framework.
Change-Id: If882f7a822ef6b1e58666b3af6f7166ab0a230fe
2011-12-15 19:44:33 +00:00
Brian Waldon
a905e5fe07 Accept 1 and 2 as version choices
- removes all unused imports
- update .gitignore with new venv path

Change-Id: I3e8199b72dc83268115133d7c73335ffb6060f9a
2011-12-14 14:44:26 -05:00