Now if --os-image-api-version mistakenly contains a string then
you will get a ValueError
Example:
$ glance --os-image-api-version hui
ValueError: invalid literal for int() with base 10: 'hui'
This code correctly handles this situation, prints a warning
message and interrupts the execution of the client
Change-Id: I4733578adfc70bd57afd5f0d4d361c8ef689a381
Closes-bug: 1401197
We currently require a version to always be passed to discover the
client version that should be loaded. However, this information is
commonly present in the URL instead. The current behavior forces
consumers of the library to keep the required version around and/or to
strip it themselves from the URL.
This patch relaxes that requirement by making the version a keyword and
requesting instead an endpoint to be passed. The patch gives priority to
the version in the endpoint and falls back to the keyword if the later is
not present.
Follow-up patches will improve this code making it interact a bit more
with the endpoint's catalog.
Closes-bug: #1395714
Change-Id: I4ada9e724ac4709429e502b5a006604ca0453f61
This adds a useful error message when a user enters an invalid value
for --os-image-api-version. Previously, the shell directly attempted to
import the module the user specified, and printed the error from the
exception raised when that failed:
$ glance --os-image-api-version stupid-glance-version
No module named vstupid-glance-version.shell
Glanceclient now catches this exception and prints something
understandable for a user:
$ glance --os-image-api-version stupid-glance-version
"stupid-glance-version" is not a supported API version. Example values are "1" or "2".
Closes-Bug: #1395841
Change-Id: I48a95b7562c10bd68d777be408dcfa22cb05ec6a
Added functionality from keystoneclient to fallback to the tty for password
entry if no password is given via the environment or the --os-password option.
Change-Id: I096e81b61d7f499cbda300abdc14430928d18491
Closes-Bug: 1357549
This change allows easier debugging of client related issues, with a
full traceback printed out when an uncaught error occurs in the client.
Previously, it could be hard to find the portion of code raising an
exception, with just the message from the exception being displayed.
Previous behaviour (with a rather artificial client error being raised):
$ glance --debug image-list
Contrived exception
Behaviour after this patch:
$ glance --debug image-list
Traceback (most recent call last):
File "/opt/stack/python-glanceclient/glanceclient/shell.py", line 590, in main
args.func(client, args)
File "/opt/stack/python-glanceclient/glanceclient/v1/shell.py", line 77, in do_image_list
raise(Exception('Contrived exception'))
Exception: Contrived exception
Contrived exception
Change-Id: Id7b76b707e5fc16a0402dcb104ec40787e0ffbe2
API calls and shell commands added in this patch:
- CRUD for metadefs namespaces;
- CRUD for metadefs objects;
- CRUD for metadefs properites;
- CRD for metadefs resource types and resource type associations.
Change-Id: I6d15f749038e8fd24fc651f0b314df5be7c673ef
Implements: blueprint metadata-schema-catalog-support
Co-Authored-By: Facundo Maldonado <facundo.n.maldonado@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Currently glance client does not support command completion.
The intention is to add this functionality to the client
blueprint add-bash-completion
Change-Id: I725dd308118b101e87182acf0cee6dbfd214e0e4
To help end user uses profiling by glanceclient CLI directly, the
change added '--profile <HMAC_KEY>' argument to the shell.
This change also fixed a function regression, it was used to pass
necessary trace info to glance server via http header:
dbb242b776 (diff-740dd7d9149f46fe4c01ef0ab7eb3bfbL196)
In addition:
1. If client app want to enable profiling feature for glanceclient
object, please see: http://paste.openstack.org/show/85722/
2. Afer adding more trace point into Client object, as fundamental
requirement of osprofiler, what we need to notice caller is providing
correct messaging notifier in the context code.
The relevant change for glance server is ready at:
I45a19f5eb5304c2b78a9e12cbc0744941a807304
DocImpact
Change-Id: If42b69b2695a5f88536ecbc2c1b3592d9dbd880a
Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
Remove all deprecated commands from the shell
since they are no longer used and to keep
the command line menu from looking cluttered.
Closes-bug: #1314218
Change-Id: I66e82872988e3835e4f290f48dfc80538271426c
This enables glanceclient to authenticate using Keystone v3
API and includes the addition of several new CLI arguments.
DocImpact
Change-Id: I863ba08d312363dc1ce4fc7822fb21ef53df1a4f
F841 detects local variable is assigned to but never used.
This commit fixes the violations and enables F841 in gate.
Change-Id: Ic4dcac2733dfe334009327ac17aa3952cafaa63a
Make help strings consistent to use "." at end of string.
Fix capitalization of API in one help string.
Change-Id: I7cc5289d881c5e58aad9c69b4668584cdeb0b376
When using the cli the Glance client wraps the endpoint in a 'strip
version' function. This means that endpoints of the following forms can
both be used:
https://region-x.images.example.com:443/v1https://region-x.images.example.com:443
When calling the client library directly (as Ceilometer does) however
only endpoints of the second form work. The cli and library should handle
the two cases consistently.
Addresses bug 1243276.
Change-Id: Ice7b581fee32540a7057ba47433a10166a3caed2
Provides command line support for image-create, image-update,
and image-upload using the Glance V2 API. This includes building
help text for create and update based on the image jsonschema
as fetched from the server.
Also fixes bug caused by default warlock patch generation not
matching what Glance expects when updating a core property
which had not originally been set when the image was created.
Related to bp glance-client-v2
Change-Id: I841f9e3d05802f4b794cb6f4849abe03ff0324d9
This patch is for fix bug 1208784. In openstack ipv6 environment,
if the os image url is not provided, need use the provided host
to generate literal ipv6 image url.
Fixes bug 1208784
Change-Id: Icb71241a639db02d079348f086bd7bd5f0412609
When an error with non-ascii characters is caught by glanceclient, it
fails at printing it and exists with a UnicodeEncodedError. This patch
encodes errors' messages using strutils before sending them to stdout.
Fixes bug: #1200206
Change-Id: I4dabcd76ffb258840bd6a66ad23c030f34960e86
Instead of globally ignoring pyflakes and
hacking warnings, only blacklist those that trigger
very frequently so far, in order to clean them
up in followup commits. Fix and start gating
on the rest already.
Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
Glanceclient implemented both functions before they landed into oslo.
Since both functions are already in oslo, it is now possible to pull
them in.
There's a small difference between glance's implementation and oslo's,
that is the later does not convert non-str objects - int, bool - to str
before trying to decode / encode them. This patch takes care of that
where necessary, more precisely, while encoding headers before doing a
new request.
Fixes bug: #1172253
Change-Id: I9a0dca31140bae28d8ec6aede515c5bb852b701b
Some mechanical translation of the deprecated
except x,y construct. Should work with Python >= 2.6
just fine
Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
Currently a KeyboardInterrupt can be triggered by the user while the
client is communicating with keystone. This patch moves the trap
higher up in the stack.
Fixes bug: 1157905
Change-Id: I16889c2d97bc4694ab27c863c62c27333e264b60
When a user attempts to terminate the CLI with CTL+C a stack
trace is printed to the screen. When downloading files the
partial amount downloaded will not be cleaned up. In most
cases the user redirects to stdout, thus this program cannot
clean that up.
Fixes Bug: 1130390
Change-Id: If9f8ffc72b422d5dbd5969eecde8904238dd8860
Currently glanceclient doesn't support non-ASCII characters for images
names and properties (names and values as well). This patch introduces 2
functions (utils.py) that will help encoding and decoding strings in a
more "secure" way.
About the ensure_(str|unicode) functions:
They both try to use first the encoding used in stdin (or python's
default encoding if that's None) and fallback to utf-8 if those
encodings fail to decode a given text.
About the changes in glanceclient:
The major change is that all inputs will be decoded and will kept as
such inside the client's functions and will then be encoded before
being printed / sent out the client.
There are other small changes, all related to encoding to str,
around in order to avoid fails during some conversions. i.e: quoting
url encoded parameters.
Fixes bug: 1061150
Change-Id: I5c3ea93a716edfe284d19f6291d4e36028f91eb2
* Rename --ca-file to --os-cacert (--ca-file deprecated for
backward compatibility)
* Add cacert to keystoneclient initialization to verify the
keystone server certificate
This aligns glanceclient with keystoneclient for option naming
and the use of TLS for the keystone auth connection. It does not
change the use of TLS/SSL for the glance connection.
Change-Id: If8b05655aea5f3c62612d77bf947dd790f77eddf
Standardize pep8 to 1.3.3 and cleared up any errors
found by pep8 tests.
Change-Id: Ib7eb97d0789556d1676ccad58b5d3364065b7d15
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Connect the --os-region-name option passed through the CLI
to the call to service_catalog.url_for.
Fixes bug 1080739.
Change-Id: I2d19d62a999a82a91de3883db12bbc24e900de25
Use pyOpenSSL for HTTPS connections.
This allows:
* Neater loading of system CA files
* Optional disabling of SSL compression
The performance gain from disabling SSL compression is significant
in cases where the image being uploaded/downloaded is in an already
compressed format (eg qcow2).
Related to bp ssl-connect-rework.
Change-Id: I0568b6c95c5fc7b8eafdbd0284e24c453660a55a
When SSL is being used and the --ca-file option is
not specified use an available system CA file to
verify the server's certificate.
Change-Id: Id5c9fda6fd9bd05cde3c2a9160a6e72cef086a44
This allows a user to pass a cert and a key to use in HTTPS
connections. The flags --cert-file and --key-file are added
to the CLI.
Addiionally, update the debug curl logging to print --cacert and
-k when ca_file and insecure are set.
Related to bp glance-client-parity.
Change-Id: Ibaea51419a903afb7939a6b5b848f7a6667893bf
This adds support for validation of ssl certs returned by remote
servers over SSL. The --ca-file param represents the CA cert used
to sign the remote server's cert. Use --insecure if the remote
server is using a self-signed cert or you don't have the CA cert.
Related to bp glance-client-parity
Change-Id: I45253a6e2d88da599addfcc464571e62ae920166