40 Commits

Author SHA1 Message Date
Hervé Beraud
d66530fda8 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ifeaa5ba961c849a40407f4b3cc172f1423df3eaf
2020-06-02 20:49:16 +02:00
jacky06
038146d500 Remove six
We don't need this in a Python 3-only world.

Change-Id: I7f39c971de09684ad34cdd21ae6819bde797efb0
2020-05-06 00:42:29 +08:00
Andreas Jaeger
5d93b51900 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 2.0 which
supports Python 3.

Fix problems found.

Change-Id: I81cf5e317bb2f791888e75d87cfd27dfdd2b5f96
2020-03-28 15:54:06 +01:00
Tovin Seven
7f573470b5 Make --profile load from environment variables
--profile argument can be loaded from OS_PROFILE environment variables
to avoid repeating --profile in client commands.

Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>
Change-Id: I67fa2538a10788ac6942995b440c22facb81fc68
2017-06-19 13:37:18 +07:00
Jenkins
67976c4826 Merge "Increase Test coverage" 2017-03-20 18:35:21 +00:00
yatinkarel
278232620d Increase Test coverage
Increase Test coverage from 80% to 84%.
Removed unused code of SecretsHelper.

Change-Id: I7bf81f44defde984c8201423447d4071682a8c99
Partially-Implements: magnumclient-ut-coverage
2017-03-10 12:33:11 +05:30
Tovin Seven
6eeb433e11 Correct mistake from OSprofiler help
My mistake in OSprofiler help when copy some code from novaclient

Correct nit in: I85f766f636f754fc6ad8e28e3df2793cd02a618e

Change-Id: I195d1a02e7c4f10858caf61a1857537ad8dff189
2017-03-07 09:39:16 +07:00
Jenkins
8ad0230e33 Merge "Allow name as positional argument" 2017-02-23 18:28:50 +00:00
Jason Dunsmore
cb8edde0b6 Allow name as positional argument
Make "magnum cluster-create" and "magnum cluster-template-create"
accept name as a positional like the other magnum subcommands.

Implements: blueprint positional-name
Change-Id: Ie505ef8ea7e4c13ed2795cde826b9822d094aaeb
2017-02-22 14:06:14 -05:00
Jason Dunsmore
b6f3b34d43 Simplify magnumclient.shell.OpenStackMagnumShell.main()
This will help with the following flake8 failure:

magnumclient/shell.py:544:1: C901 'OpenStackMagnumShell.main' is too complex (20)
    def main(self, argv):
    ^

Change-Id: Id1def3850112d689d151951f587f58e20fc0b22d
Partially-Implements: blueprint positional-name
2017-02-22 09:04:58 -05:00
Tovin Seven
1c2385ca55 Integrate OSprofiler in Magnum Client
Add OSprofiler support in Magnum Client

Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>

Change-Id: I85f766f636f754fc6ad8e28e3df2793cd02a618e
Depends-On: I7d68995aab81d365433950aada078ef1fcd5469b
Implements: blueprint osprofiler-support-in-magnum
2017-01-24 08:32:35 +07:00
yatin
f2af2b255f Mark help messages for Translation
Currently only few help messages are marked for translation.

With this patch all the help messages are marked for
translation so that they can be tracked by Zanata bot.

Change-Id: I025e94f5148b32ba2cdcb1fa7ee2219d27da68a1
Closes-Bug: #1653053
2017-01-04 12:18:58 +05:30
Stephen Watson
e7f084dfa9 Implement Parameter Deprecation
Implements parameter deprecation for magnum client via decorator
in cliutils.py and additional logic in magnumclient/shell.py.

Logic in shell creates mutual exclusive (mutex) groups in argparse
to enable parameter checking for required and unrequired parameters
specifically to check for old parameters that are being deprecated
in favor of newer ones.

Change-Id: Ic72c876e556070a066b1693a119a389301dfa259
Implements: blueprint rename-id-parameter-names
2016-11-15 09:58:03 -07:00
OTSUKA, Yuanying
a738ea7911 Add microversioning support for httpclient
This patch adds 'OpenStack-API-Version' header for each
requests.

Change-Id: I49310f1b53447ce00e78e26661cc895ce4f1c4e5
Implements: blueprint api-versioning
2016-08-29 14:48:39 +09:00
OTSUKA, Yuanying
f2c49d203b Use os-client-config in shell
Use os-client-config[1] to process options and get the Session from
keystoneauth1. This adds support for reading clouds.yaml
files and supporting the OS_CLOUD env var for selecting named clouds
from a list of them.

[1]: https://github.com/openstack/os-client-config

Closes-Bug: #1599747
Change-Id: I23a6e80648e67c0b652693cd146bd9e94ad4fb23
2016-07-25 13:44:34 +09:00
OTSUKA, Yuanying
c9eabe965c Support OS_PROJECT_* env variables
OS_TENANT_NAME and OS_TENANT_ID are legacy variables.
so OS_PROJECT_NAME and OS_PROJECT_ID should be supported.

Change-Id: Ibdfa0e14d80313b8087670ccd0bd9bdbf5ba364d
Closes-Bug: #1591027
2016-06-15 10:27:16 +09:00
Hongbin Lu
e0966ebe60 Switch to a new service type "container-infra"
After this patch [1], Magnum is no longer the "Container Service", it
became the "Container Infrastructure Management Service". Based on the
decision, this patch proposed to rename Magnum service type from
"container" to "container-infra". The old service type will be
deprecated and eventually not supported.

There is another patch [2] on Magnum server side for the renaming.
This patch should land first, then the server patch.

[1] https://review.openstack.org/#/c/311476/
[2] https://review.openstack.org/#/c/319300/

Change-Id: I55205ff2b304678d2b53bbd4d66403078c6baac8
Closes-Bug: #1584251
2016-05-20 17:46:56 -05:00
Yang Hongyang
c7d2bbfc0f Sync with oslo-incubator
Apiclient[1] and cliutils[2] is removed form Oslo incubator, we should keep
the local copy by ourself.
1. copy openstack/common/apiclient to common/apiclient
2. only keep base, auth, exceptions from apiclient, others are unused
3. copy openstack/common/cliutils.py to common/cliutils.py
4. update all magnumclient.openstack.common.* users to use
   magnumclient.common.*

This is the first step to delete openstack common modules.

[1] Change: I2020d73fa9cedb3b3b87c1d8dbc8d437857ec7c2
[2] Change: Ibc5a8f11c6e5c308cec15a60eeb07a898254f9b7

Partial-Bug: #1545957
Change-Id: Ide3814d87ecdf3255868bf3b78fdceb58bd14295
2016-02-18 13:06:00 +08:00
Ian Cordasco
5119ee0a67 Add Keystone v3 compatibility
Change-Id: Ib15713b52710412d3a887f399d1684c0e3fc5475
Closes-bug: #1538302
2016-01-27 08:42:56 -06:00
Jenkins
2ed3a6411c Merge "Add --insecure option" 2016-01-25 08:51:44 +00:00
Jenkins
3f62a5e4c3 Merge "Python 3.4 compatibility" 2016-01-22 07:58:58 +00:00
Christoph Jansen
1a7a781e48 Python 3.4 compatibility
This commit fixes two issues, which make the client work with Python
3.4 and still being compatible with Python 2.7. The first issue is,
that the command line args somehow become a Map instead of list in
Python 3.4. I fixed it by explicitly making argv (sys.argv) a list.
The second issue is in the httpclient.py, where the values of a http
response are of type byte, which cannot be joined by join method of
string. I fixed it by decoding byte to utf-8 string. Additional if
statement satisfies wrong Python 3.4 test behavior.

Change-Id: Ifaf03cbc5512dcbe82cfc37bc0c8471ffdbc7018
Closes-Bug: #1535821
2016-01-21 13:53:38 +01:00
Corey O'Brien
db4dec5276 Add --insecure option
Adds insecure option and associated MAGNUMCLIENT_INSECURE environment
variable for skipping SSL certificate verifcation in the client.

Change-Id: I0396453e8315c5f24703161457c91f7640827b8d
2016-01-20 17:12:57 -05:00
Jenkins
a762bbc36e Merge "Fix endpoint_types" 2016-01-20 07:44:34 +00:00
Niall Bunting
80ebe59f1a Fix endpoint_types
Endpoint types does not get set as when the shell creates the client
object the endpoint_type is not passed.

This causes the client to default the endpoint type to 'public'.

This change passes endpoint_type from the shell to the client.

Change-Id: I12afb072174d25152223a77601546ed26b5e5b62
Closes-Bug: 1535396
2016-01-19 13:35:44 +00:00
Niall Bunting
9738b96ca7 Change the endpoint env varible
Currently the varible is MAGNUM_ENDPOINT_TYPE rather than
OS_ENDPOINT_TYPE. This should be changed to match the rest of Openstack.

Change-Id: Ifdbf37ff12858cf26678f53e1967fb005d55574d
Closes-Bug: 1535400
2016-01-18 18:12:07 +00:00
houming-wang
0c547422bb Remove references to _i18n and apiclient.exceptions
Since oslo-incubator is no longer maintained[1] after
90ae25e38915cc502d9e9c52d59e8fb668a72ae1. We should cleanup
the deprecated code.

This patch do the following cleanup actions:
1. Use magnumclient.i18n instead of
magnumclient.openstack.common._i18n.
2. Use magnumclient.exceptions instead of the deprecated
magnumclient.openstack.common.apiclient.exceptions[2].

[1] http://lists.openstack.org/pipermail/openstack-dev/2015-November/
    079343.html
[2] https://github.com/openstack/python-magnumclient/blob/master/
    magnumclient/openstack/common/apiclient/exceptions.py#L25

Change-Id: I6fae1f84d211d661bb363e43167cdf8b6b06fd4d
Partial-Bug: #1529316
2015-12-26 00:07:11 -05:00
OTSUKA, Yuanying
8480e0b0f1 Split v1 shell sub-command into specific files
v1 shell has many sub command. It is difficult to add more test
and functions. Actually we have forgotten to add some tests for
these sub-commands.
This patch splits these.

Change-Id: I6b80b621311442df987e6ff031e8c77cf4bb7095
Closes-Bug: #1515109
2015-11-19 09:47:17 +09:00
James Page
5eb6725bde Add support for python >= 3.4
Python 3.4 changed some of the output from argparse and the
handling of default func and command behaviour; this patch
deals with both < and >= 3.4 behaviour.

Change-Id: I27983f7b06fc16aeedb98a4b36f7ff9a451706ec
Closes-Bug: 1496805
2015-09-18 09:45:01 +01:00
Doug Hellmann
a6b486d3e0 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: Id26264ad0b002ab21e60431a2fd39fcecf76c490
2015-05-06 19:32:54 +00:00
Cedric Brandily
3cbf79dec0 Support keystone region
This changes enables keystone region support using:

* an option: --os-region-name=<region-name>
* an env variable: OS_REGION_NAME=<region-name>

DocImpact
Closes-Bug: #1436774

Change-Id: I1f82d437f05c2d96ed7ed12d22906efd00edbacb
2015-03-26 21:36:18 +01:00
Jenkins
b25dfc61f8 Merge "Default version should be v1 in magnum" 2015-01-16 05:21:12 +00:00
Kennan
b02a4dacc5 Default version should be v1 in magnum
1. Change code use 'api' as version
2. remove unused setting

Change-Id: I3638ddd4afbd9057133f54d2ff26d4e8e352a515
2015-01-16 11:04:30 +08:00
Hongbin Lu
17bdfa26ca Fix an error on not finding log handler
When server return a failure response, magnumclient will use the python
logging library to log the status. The library will attempt to log the
failure by finding a log handler to do the actual logging tasks. If there
is no log handler, no message will be logged and the error message below
will be printed.

No handlers could be found for logger "magnumclient.common.httpclient"

In before, magnumclient did not add any log handler on non-debug mode,
which is a bug. This commit is for fixing that. It should be mentioned
that there is another commit 5b59253667a12a1b592d967bbcaa1f1adda559d3
(which has been reverted by 442e08b2895ad7eae29ce8ee7ffa0e4ba445f36c)
for addressing the same problem. However, this commit is a better fix since
it calls function basicConfig to add a default handler to root logger,
which ensure that there is always a handler globally.

Related-Bug: 1410444
Related-Bug: 1410507
Related-Bug: 1410510
Change-Id: I1697ff2d4fb47cdabf8da19ba862abcaed3a44ee
2015-01-16 02:28:37 +00:00
Jay Lau
c768d7abee Change folder of api to v1 for magumclient
It is better taht we can change the folder of api to v1 for
magnumclient in case we have v2, v3 ... vx in future.

Change-Id: If59c77e5d1c184c65f1e73ddd43fd89fcdcba18e
2014-12-30 11:05:23 -05:00
Abhishek Chanda
72f009079c Misc cleanups
- Removed all commented code from shell.py
- Removed unused magnum.py

Change-Id: Id4347d2c3424a784ef3978c3ab3afe1705230105
2014-11-30 14:17:52 +05:30
Jenkins
6203b18de7 Merge "Add client resources and managers" 2014-11-26 01:02:35 +00:00
Motohiro OTSUKA
cc031af4ca Add client resources and managers
Add initial managers for client resources, which are
- BayManager
- PodManager
- ServiceManager
- ContainerManager

Change-Id: Ib314225fa237f44b56cf81e2a8df6e15f8592e5b
2014-11-26 09:52:30 +09:00
Motohiro OTSUKA
049578d76c Added default service type.
This added default service type of Magnum which may be registered
in Keystone service catalog.

Change-Id: Ib0045af8b0e1e93cb3000b34a63a0a0747fdcdc5
2014-11-25 14:39:43 +09:00
Abhishek Chanda
ff36501bf1 Skeleton for the cli client
Most of this code is based on the saharaclient

Change-Id: I2af95da43273fa8636f490d62b6e71abc8e02eb0
2014-11-21 15:22:41 -08:00