This reverts commit 3bde9c3f427110dae3480644752f49b79ac66ec5.
This change is a part of a series that is not backwards compatible.
It broke applications using the client library.
Change-Id: Id01a0a0feb601539d3855f445ebaf6a3cc000610
Partial-Bug: #1340596
There is a variable which is not defined but used, we should define it
before using. Add a test for get_resource_manager_extra_kwargs_hook
function, and change the exception to a more detail instead broad
'Exception'.
Change-Id: I7a798dad55a65f06ebbe175925a00028940bb168
F841 detects local variable is assigned to but never used.
This commit fix the violations and enable F841 in gate.
Change-Id: I52419f5e17db70e511ff2d4d61c85458c958e9c3
Fix:
Intially the cli was raising "CommadError" in case the requested
flavor or image were not present.
This error category was not approrpiate as it signifies an error
in the command syntax. When the requested resource (flavour/image)
does not exist, a ResourceNotFound error should be raised. So,
added a new error category "ResourceNotFound" to cater for this
scenario and updated the code to raise this new error.
"nova show <instance_name>" command has also been updated to raise
"ResourceNotFound" error when the requested vm for which details
have to be displayed does not exist.
Closes-Bug: #1258488
Change-Id: If64a087944586ef5792efe3baa62e455b9bbaa07
When we delete or show a keypair, if the keypair doesn't exist,
we'll get "The resource could not be found.(HTTP 404)", this
patch will change it to "ERROR: No keypair with a name or ID of
'keypair_name' exists."
Change-Id: Ifebd8d2213c327f3d3fdd672207170aebbe1bb40
Closes-Bug: #1307338
This change applies a regular expression in order to filter
flavor extraspects keys with invalid characters.
The characters allowed are: letters, numbers, underscores,
periods, colons, spaces and hyphens.
A new test flavor has been created which doesn't check the
keys in the post body. This flavor has been created in the
third place (instead of in the last) in order to keep
working existent test cases which depend on the last flavor
received in the get method.
Change-Id: Ifd86bed23a05a5946ae8b9ba6f6c9bf4b24b1d4c
Partial-Bug: #1256119
This change make all the text visible by the user i18n. The
messages changes are in prints, logs, exceptions, helps, etc
Pep8 errors about "Multiple positional placeholders" also fixed
Change-Id: I731afea790baddbc34d059b93a35e3d275fc1df8
This patchset updates modules based on the config file:
openstack-common.conf
Notes: Some corrections has been added to work with
new files.
+ utils.py: The method safe_decode from strutils.py
was updated and it is now not necessary to check for
decode string with py33.
+ base.py: base64 needs a 8-bit string for py33
+ test_shell.py: stdin.encoding is needed for strutils
Change-Id: Iebe474f1226f8b5faa7fb5722e65f41b80d1973c
Related to blueprint common-client-library-2
Closes-Bug: #1265473
There are some common methods in cliutils we can use in novaclient:
arg, env, unauthenticated, isunauthenticated.
+ Replaces utils.env to add alias env from cliutils.
+ Replaces utils.arg to add alias arg from cliutils.
+ Removes unused methods: add_arg, unauthenticated, isunauthenticated
To use methods from clituils.
Related to blueprint common-client-library-2
Change-Id: Ic7c132c37d6a91cf3eae55530300efd153c31903
For perviously logic, if flavor id is
start with "0Number", int(name_or_id)
will convert it to "Number". If flavor
id "Number" exist in DB, it will show
up for query with "0Number".
This fix enter flavor search logic at
the beginning. Also add one more UT
for this function.
Change-Id: Ic48ff4275978404064c0c6fce6f98181660aa84a
Fixes: bug 1268456
Print hyphen(-) in python client output when attribute value is not
set(NoneType) so that it is distinguishable between "None" string
and NoneType value.
Change-Id: I5ec0f39f13aca45fa95ddb59472c20207c63bf91
Closes-Bug: #1266414
The bash completion code is the sole user of the slugify() function
in utils, which is substantially similar to to_slug() provided in
strutils from oslo.
Change-Id: Ib4eb7e4c0fa0e9bc5c4a0856f6391911d8f8fd3b
Closes-bug: #1266118
Print the dictionaries and arrays without the unicode tags.
The patch also updated tests that did not return valid data.
Change-Id: Ia787f98a9510b68beb3ceaf00c285ca5c934f5c0
Closes-bug: #1265002
Instead of using novaclient.utils' bool_from_str, use bool_from_string
from the oslo incubating strutils
Notes:
0. utils.bool_from_str was strict, only accepted a small set of
values, while strutils.bool_from_string is not strict by default,
anything not true is false
1. bool_from_string accepts on/off, which bool_from_str did not
Change-Id: I04744844b55697819289def081d3c9117ed0713f
'nova aggregate-details' shows Hosts, Availability Zone
and Metadata in the python unicode notation.
+ Adds some tests about aggregates ported from v1 to the
v3 shell
Change-Id: I69d80b2e76833d78248dee782ae5e53f42a4f4a9
Closes-Bug: #1132961
Flatten the nested dicts so that hypervisor information can be more
easily used at the command line.
Change-Id: I5dfcf9d10f917a63bde09f0b5a691784a5e8f02b
Closes-bug: #1243512
'nova aggregate-details' shows Hosts, Availability Zone
and Metadata in the python unicode notation.
Change-Id: If0028347146439994265c60c429af05dd67912f9
Closes-Bug: #1132961
1. strutils.safe_encode() return "bytes" in py33.
2. find_resource() makes use of uuid.UUID() to verify the given
uuid argument, uuid.UUID() will trigger TypeError when input is
"bytes".
so, decode the bytes before uuid.UUID() while run in Python 3.
Close-bug #1232445
Change-Id: I504be7b43236b3a4843655706385e506cd559e4e
Python 2:
str.encode = encode(...)
S.encode([encoding[,errors]]) -> object
Python 3:
str.encode = encode(...)
S.encode(encoding='utf-8', errors='strict') -> bytes
In Python 3, strings are always Unicode. safe_encode() returns
"bytes", the "\n" will be printed literally, it is not expected.
bytes.decode() will transform bytes to str, which will be printed
properly.
Close-bug: #1229150
Change-Id: If926d3f7837673b4608ae667d34cea3c78e82e5d
Python3 uses the the concepts of text and (binary) data
instead of Unicode strings and 8-bit strings. In python3
all text is unicode; however encoded unicode is represented
as binary data.
Use the six module to use six.binary_types and six.text_types
where apporiate:
- six.text_type unicode() in python2 and str in python3.
- six.basestring() in python2 and str in python3.
blueprint python3-novaclient
Change-Id: Ie7b393abe6beac22eaf127b7fc7bbc372c338211
Signed-off-by: Chuck Short <chuck.short@canonical.com>
While running the unit tests with python3 the following
traceback appears:
TypeError: can't use a string pattern on a bytes-like object
This is due to the way that python2 and python3 handles unicodes.
Change-Id: I401f1cefed69780073222cae98d8da4c3d8031a8
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Administrator cannot use the flavor name in arguments of
"nova flavor-access-add" and "nova flavor-access-remove".
This patch fixes this problem.
Change-Id: I68b267dc071382f1978efc2088cd8e837455e8b4
Related-Bug: #1205298
Administrator cannot use the flavor name in arguments of
"nova flavor-access-add" and "nova flavor-access-remove"
in following conditions.
1. The flavor is non-public.
2. The falvor doesn't belong administrator's tenant.
This patch fixes this problem.
Change-Id: Ic5e3222d0ff62667e003a61e6a94e85833da5d11
Fixes: bug #1205298
In python3 dict.iteritems(), dict.iterkeys(), and
dict.itervalues() are no longer supported. So use
six.iteritems() where it is appropriate.
Change-Id: I8b07dc2a89d790ec275d45f859e1644e9b00c837
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Python3 enforces the distinction between byte strings and text strings
more rigorously than python2. So use six.text_type/six.u()
where appropriate
Change-Id: I890e19cb857e10f0292aabdaebaa8e7a7bd8db23
Signed-off-by: Chuck Short <chuck.short@canonical.com>
In the original code, isalnum() in is_uuid_like() doesn't allow "-",
while for UUID, format like aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa should be
allowed. This patch is to reuse uuidutils's API in oslo.
Change-Id: I339974c75a32d27f8e4443a1b97bb6e410933aa4
Signed-off-by: Shane Wang <shane.wang@intel.com>
Some cleanups include:
- Add flavor sub-commands into README.rst
- Check flavor ID when creating a flavor
- Remove check_uuid_like() because it isn't used
- Remove parameter cs in some _print_XXX functions because cs is
not used
Change-Id: If47ce557d33db05f53e382f0670f436e05a340b7
Signed-off-by: Shane Wang <shane.wang@intel.com>