43 Commits

Author SHA1 Message Date
Goutham Pacha Ravi
b955ac9064 [Python3] Fix python3 bugs in code
- The BaseException class no longer has a "message"
  attribute in python 3 [1]. On the contrary, the
  string representation of an Exception object will
  print all the exception args in all supported
  python versions, so use that instead.
- Functional tests were run with a specific locale,
  remove those annotations so we can handle unicode
  encoding and decoding in python3 envs.
- Cleanup errors were not being handled correctly,
  cleanup the code so we don't have spurious failures.
- In python3, dict.keys() gives you a view for lazy
  loading, so convert occurrences to lists as expected
  in our functional tests.
- Start capturing STDOUT and STDERR in tox envs to
  enable troubleshooting.

Co-Authored-By: Goutham Pacha Ravi <gouthampravi@gmail.com>
Closes-Bug: #1811627
Closes-Bug: #1811516
Change-Id: Idaa2fb9b60451b3fbd298e19574195f2d663c6f4
[1] https://www.python.org/dev/peps/pep-0352/#transition-plan
2019-01-17 12:47:03 +00:00
junboli
b0b08cc650 allow '--help' to print subcomands info
Currently, we only allow $manila help subcomand to print
subcomands info, if we are using $manila subcomand --help,
it will print all the subcomands info, that is not what we
want, this change is to allow '--help' to print subcomands
info. finally we can see the following comands are equals:

$ manila --help list
$ manila list --help
$ manila help list

Change-Id: I926defd6c5d3b8d87b038e2c63db694b40a88359
Close-bug: #1771097
2018-05-23 10:33:49 +08:00
junboli
caf07cabf3 Fix manila endpoint in catalog not find error
This issue occurs when we list share without add manilav1 endpoint,
there will be "could not find Manila endpoint in catalog".

Since manilav1 has been deprecated for a couple of releases, so there
is no need to add manilav1 endpoint when using manila v2 API.

This change is to fix it without add manilav1 endpoint, we can also
perform manila command with manilav2 endpoint when using manila v2
API.

Change-Id: I68b499e153e1aba3a5a285f07d71e31b6af65bca
Closes-Bug: #1558995
Closes-Bug: #1734016
2018-02-26 10:33:08 +08:00
Jenkins
389aca09ef Merge "Fix for use endpoint_type in _discover_client method" 2017-10-10 05:46:58 +00:00
Kudyukin Dmitry
b9f897ec70 Fix for use endpoint_type in _discover_client method
In _discover_client method endpoint_type gets DEFAULT_MANILA_ENDPOINT_TYPE
rather getting endpoint type from shell. In case
DEFAULT_MANILA_ENDPOINT_TYPE unavaliable client fails.

Co-Authored-By: Thomas Bechtold <tbechtold@suse.com>
Closes-Bug: #1620491

Change-Id: I132fa448994b2f42e7fd8873425f81c88dbde8ee
2017-10-09 16:46:03 +02:00
Gage Hugo
fe0abc4929 Correct import of keystoneauth1 session
keystoneclient.session has been long deprecated in favor of
keystoneauth1.session. This change corrects the import to use
keystoneauth1.session instead of keystoneclient.session.

Change-Id: Ibb3448fa4f96bbaf899a9ed010556c1c43896e29
2017-09-12 17:17:50 -05:00
ChangBo Guo(gcb)
c8bb1a2755 Remove copy of incubated Oslo code
The Oslo team has moved all previously incubated code from the
openstack/oslo-incubator repository into separate library repositories
and released those libraries to the Python Package Index. Many of our
big tent project teams are still using the old, unsupported, incubated
versions of the code. The Oslo team has been working to remove that
incubated code from projects, and the time has come to finish that work.

As one of community-wide goals in Ocata, please see:
https://github.com/openstack/governance/blob/master/goals/ocata/remove-incubated-oslo-code.rst

Note: This commit also fix pep8 violations.
Change-Id: I03288adb94c702d1d63df88ef9ba33a2ff59eaa3
2016-09-28 10:06:45 +08:00
Marc Koderer
f387243e36 Add validation for token and bypass_url
Specifying only token or only bypass_url leads to a client error.
Better to have a corresponding sanity check on shell level to
include the needed parameters/env variables.

Change-Id: I55dac599d4dadc273eacab14746bf449d3495f2b
Closes-bug: #1604820
2016-08-12 15:48:47 +02:00
dineshbhor
093a2e69f6 Replace OpenStack LLC with OpenStack Foundation
TrivialFix
Change-Id: I336952baacf55e36ad0a56ac98b95977fc0d593a
Closes-Bug: #1214176
2016-07-26 12:21:45 +00:00
Marc Koderer
65996e210f Use consistent env variable naming
Old env variables are still supported but the default ones should
consistently use OS_ as prefix.

Change-Id: Idd26a587cade7f6a27115c4e8cf220cd43b1703e
Closes-bug: #1603387
2016-07-18 09:54:12 +02:00
Jenkins
cdbbba7019 Merge "Fix "single_alias" action for CLI commands" 2016-05-27 14:27:51 +00:00
Valeriy Ponomaryov
5a3ef94c5b Add possibility to provide auth token via CLI
Python part of Manilaclient does support auth by token, but
CLI part does not. Therefore, add two new optional args
with related env vars:
--os-token [OS_TOKEN]
--bypass-url [MANILACLIENT_BYPASS_URL]

Also, disable checks for other auth data if these two are provided.

Change-Id: I567294dfb61e702410c3f0fadc15a04667075434
Closes-Bug: #1572095
2016-05-16 20:02:06 +03:00
Valeriy Ponomaryov
ea5c3e7b28 Fix "single_alias" action for CLI commands
For the moment if default value for CLI option with
"single_alias" action is different than None we cannot redefine it.
Fix it and cover with unit tests.

Also, fix existing aliases and add some where good to have.

Change-Id: Ic61426d9bd894b01f9b035d6d19bb7bd113f96ad
Closes-Bug: #1552771
2016-05-16 13:24:37 +03:00
Chuck Fouts
8143f7aa1c UnsupportedVersion Thrown for Supported Version
If the maximum client version is higher than the maximum server version,
but the server version is otherwise valid, an UnsupportedVersion
exception is thrown. This bug fixes this issue by downgrading the
requested version, during API version discovery, from the maximum
client version to the maximum server version. The maximum server version
must be supported by the client. If all conditions are properly met the
client will continue to use the maximum server version for the remainder
of the request.

In order to log that the client version is being downgraded to match
the server version, when using the --debug flag, it was necessary to
update the logging configuration. Logging can now be used anywhere in
manilaclient as needed.

Change-Id: I96d273071966d2dc63de40c6f1b777fbb34a50fa
Closes-Bug: 1559290
2016-03-30 17:59:23 +00:00
Thomas Bechtold
9a362ff188 Add uppercase env var names for consistency
Some env var names (the vars starting with manilaclient_) are mixing
lower and uppercase. To be consistent with the other env vars (and
also with env vars from other openstack client projects), add also
the only-upper-case var names. Newly added env variables are:

- MANILACLIENT_UUID_CACHE_DIR
- MANILACLIENT_DEBUG
- MANILACLIENT_INSECURE

Closes-bug: #1535284
Change-Id: Ifd43c6d226487d2b1c4ec099096595373725e596
2016-01-18 13:27:46 +01:00
cFouts
c34e3b7d2c Nova Style API Version Support for Client
The Manila client needs the following changes to support microversions:

*   Maintain backwards compatibility with Kilo. When the client detects
    that the server doesn't support microversions it will fall back to
    using the v1 API.
*   The --os-share-api-version option supports overriding the version.
*   If 1.0 is specified as the version the client will load the v1
    client and use the server's v1 API.
*   The client will send a request for the server's API version and
    determine if the client's supported versions and the server's
    supported versions overlap. If not the client will display an error
    and quit. See diagram 1 below.
*   The client supports the @wraps annotation. The annotation is used
    with the v2/shell.py commands and any class that inherits from
    the Manager class in manilaclient/base.py.
*   If an appropriate command version isn't found for commands using
    @wraps then the client will display an error and quit.

following commit: ab49d645befd04c84272f0d24e1b604012d191dd.

Diagram 1:
  Client:
         2.5           2.8
          |-------------|

  Server1:
     2.0           2.5
      |-------------|
     Client uses version 2.5

  Server2:
               2.7           2.10
                |-------------|
               Client uses version 2.8

  Server3:
                  2.9           2.12
                   |-------------|
                  Client displays error and quits

  Server4:
     1.0 (Kilo Server)
      |-|
     Client detects pre-microversion server and loads v1 client

Example usage of wraps annotation:
*   Support 2.0 - 2.4: @api_versions.wraps("2.0", "2.4")
*   Support 2.5 - latest: @api_versions.wraps("2.5")

Implements: blueprint manila-client-advanced-microversion-support

Change-Id: I3733fe85424e39566addc070d42609e508259f19
2015-11-16 19:03:55 +00:00
Valeriy Ponomaryov
997cc43433 Add Keystone v3 API support
Keystone is used for authentication in Manila and the latter's
client does not support latest version of it that exists for long time.

So, add support of Keystone v3 API and make Manila client to use it
at first priority if it is available.

Change-Id: I3e2f505f46f7ab60c66bcb0b1d65a38bea602df4
Closes-Bug: #1499260
2015-10-13 21:12:55 +03:00
cFouts
3cd57eb32e Fix client API version to support Manila API
The Manila client's API version is now '2.5' so that it matches the
Manila server's API version.

The client also supports the Manila V2 Keystone endpoint such that it
will only communicate with the Manila V2 API.

Closes-bug: 1494360

Change-Id: I3d011046bbe4f9223d93341f3d3ac09074f52990
2015-09-14 01:07:07 +00:00
cFouts
36384fa190 Manila REST API Microversion Support for Client
Manila client needs to provide 'X-Openstack-Manila-Api-Version' in the
HTTP request header along with the appropriate version. Manila client
also needs to provide 'X-OpenStack-Manila-API-Experimental' in the HTTP
request header for APIs that are marked as experimental. This is a
temporary fix until Manila client can support Nova style microversions.

Closes-bug: #1489450

Change-Id: I6344dfa6d272f0e813a4873c015be614ebeb4e7e
2015-09-01 21:01:18 +00:00
Doug Hellmann
25d9af18bc Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Ib86c36f81f6fdbee64d88dd0b1d126bcc16649ac
2015-05-06 19:35:22 +00:00
Igor Malinovskiy
58cc003661 Add keystone-session support
Currently python-manilaclient doesn't support keystone sessions
unlike to others clients. keystoneclient.session.Session gives
end-user possibility to share common authentication and request
parameters between a variety of services.

- Add python-keystoneclient to requirements.txt
- Move authentication logic to v1/client.py
- Move HttpClient to separate module
- Simplify SecretsHelper in shell.py
- Replace service_catalog module by keystoneclient.service_catalog
- Add appropriate unit tests

Implements bp add-keystone-session-support

Change-Id: I7d1c50fa31d9e2f32bb518a78a02bc12b114d0ab
2015-02-23 11:51:27 +02:00
Denis Cavalcante
8ce8771fe9 Add -d short option for --debug
Result: [-d, --debug] for printing debug messages

Change-Id: Ia5db6d85bc474255be0fa11eca4babf057993fcc
Closes-Bug: #1420936
2015-02-12 05:49:16 -08:00
Andreas Jaeger
ca870810c9 Use oslo.utils
Replace usage of oslo-incubator modules strutils, importutils, timeutils
with corresponding oslo.utils modules instead.
Removes timeutils module, others will be replaced with next oslo-incubator sync.

Change-Id: I12530f4e4d745f9a95b339182e31189e32e56fa6
2014-10-23 08:13:25 +02:00
Your Name
5e71ffc159 Handle ambiguous option error for aliases properly
When we have more than one alias for one command option, like
"manila list [--snapshot_id %id%][--snapshot-id %id%]"

We should be ok provided request like following:
"manila list --snapshot %id%"

This change makes above possible.

Also added restriction to use only one alias at a time.

Change-Id: Ibd7de3b75408d50ff97b5b9d19307a5612d7b425
Closes-Bug: #1379472
2014-10-09 19:01:55 +00:00
Andreas Jaeger
542b59e891 Improve help strings
Make help strings consistent, following oslo.config recommendations:
* Capitalize properly
* Fix grammar and language
* Add "." at end of help string

Change-Id: I412eca2ee67c5e6152f0a70b2a5073ebd190796d
2014-08-22 19:20:43 +02:00
vponomaryov
4a7e7cf089 Cleanup manilaclient.utils module (part 2)
Remove functions 'arg', 'env' and 'add_arg' from
manilaclient.utils and use same functions from cliutils instead.

Partially implements: blueprint use-common-code

Change-Id: Ib41250d527c5949cdfb7c6956703ff4b371a062b
2014-08-04 11:06:28 -04:00
vponomaryov
b11f5d78a2 Cleanup manilaclient.utils module (part 1)
First part of manilaclient.utils module cleanup,
where usage of deleted functions replaced with functions
from common code.

Partially implements: blueprint use-common-code

Change-Id: Iefe7da601cdaf030787c6d7588dd0c1706e309cd
2014-08-04 10:52:10 -04:00
vponomaryov
900b660618 Fix and enable E12 pep8 rule (indentation issues)
Change-Id: I500d2cacba09f2a4337ff325ae658f61b64e4b7a
Related-Bug: #1333290
2014-07-10 05:22:37 -04:00
Julia Varlamova
02fb7a62d1 Add an ability to cache auth token
Add option --os-cache, which defaults to OS_CACHE variable
(by default - False). When this option is specified, manilaclient
will use auth token saved in keyring. First time when command will
be called, auth token and user password will be saved in keyring.
Using --os-reset-cache option password and auth_token stored in the
keyring can be deleted.

Implements bp cache-auth-token

Change-Id: Ia8959655528acce726baa616e66901c7a96fd35c
2014-07-07 17:22:28 +04:00
vponomaryov
0ccdb38dd2 Remove py33 incompatibilities
Except py33 compatibility changes were added unittests
to cover changed code.

Partially-implements blueprint py3-compatibility
Change-Id: Ib51e02ec69100a842ea1092e9f659ab1ebede671
2014-06-28 06:09:55 +00:00
Valeriy Ponomaryov
dc1926e9ad Enable H23* rules in pep/flake (py3-compat)
Basic python 3 compatibility fixies

Change-Id: I97726d42706c538d40cb1662112e56c13432e87f
Related-Bug: #1333290
2014-06-28 06:07:02 +00:00
Valeriy Ponomaryov
493ec0a538 Enable H30* rules in pep/flake
Second part of pep/flake fixies, that enables H30* group of rules.

Change-Id: Ib481887a37633a72dd5691c716b9214900a9384b
Related-Bug: #1333290
2014-06-28 06:06:50 +00:00
Valeriy Ponomaryov
b87c55d5fc Enable H40* rules in pep/flake
First part of pep/flake fixies, that enables H40* group of rules.

Change-Id: Ia85b49645b3bf634e99877855e6b31a404331b7f
Related-Bug: #1333290
2014-06-28 08:48:32 +03:00
Yulia Portnova
00ccdd3831 Added detail parameter to list methods
Added detail parameter to list methods for security_services
and share_networks in v1.
Closes-bug #1297824

Change-Id: Iac2384bbf69c18f75291cc58509e8e99d0ac93ff
2014-04-01 14:58:01 +03:00
Andrei V. Ostapenko
e5562354e4 Added support of per-tenant-user quotas
Added new keys '--user' in v1.shell to quota-show, quota-update.
Added command quota-delete, that provides ability for admins
to be able to delete a non-default quota (absolute limit) for a tenant
or user, so that tenant's quota will revert back to the configured default.
Added 'responce_key' parameter to Manager._update function
Added '--force' parameter to quota-update to support new functionality
on server
Fixes help output, when in 'manila help' was displayed only first
string of command documentation

Implement bp: user-quota-support

Change-Id: Ibfe9ccf83ea43d5af6652342f1fe6a88c78a0364
2013-10-17 17:31:21 +03:00
Andrei V. Ostapenko
eae1a991c9 Removes deprecated global opts from python-manilaclient/shell.py
Closes-Bug: #1237407

Change-Id: If4054d4363c5ead5a707b9b17b194c26399c0be0
2013-10-09 16:35:45 +03:00
Yulia Portnova
95c64adea3 merged cinder-to-manila 2013-09-17 16:41:56 +03:00
119Vik
d6204d90bb added testr conf. pep8 tests fixed 2013-09-10 09:09:53 -04:00
vik
041bfa455c cleaned client with fixed tests. no quotas functionality implemented 2013-09-10 03:26:11 -04:00
Yulia Portnova
77dffa2c99 mass replace cinder to manila 2013-09-05 13:32:38 +03:00
Yulia Portnova
2d2bedf6b0 fixed service type 2013-09-05 13:14:29 +03:00
Yulia Portnova
fa125b7714 setup.py fixed 2013-09-03 14:37:34 +03:00
Yulia Portnova
7c1a8bcbef cinderclient to manilaclient 2013-09-03 14:28:38 +03:00