Commit Graph

54 Commits

Author SHA1 Message Date
Hervé Beraud 2f543950de 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: Ic9b94ceb733989b4676655cbc94eb20025908408
2020-06-02 20:50:11 +02:00
zhurong fe82041d9c Remove six usage muranoclient/v1
Depends-On: https://review.opendev.org/#/c/720636/
Depends-On: https://review.opendev.org/#/c/720631/
Depends-On: https://review.opendev.org/#/c/720632/
Depends-On: https://review.opendev.org/#/c/720638/
Depends-On: https://review.opendev.org/#/c/720639/
Change-Id: I2aa9e94279720b080d8235b510e42d202d7a0434
2020-04-17 00:08:29 -07:00
jacky06 f4c2251e26 Replace git.openstack.org URLs with opendev.org URLs
Change-Id: Iad6b06a96727b5aa05d2a2a0eeee1389fa3e0104
2019-04-26 10:36:04 +08:00
Ellen Batbouta 62e4565449 Ignore default values for deprecated security parameters
The command line parameters, ca-file, key-file, and cert-file,
are deprecated.  The problem is that the argument parser stores
the values for the deprecated parameters into the same attributes
used by Keystone.  As a result the murano dashboard is overriding
the default values of the Keystone attributes with its own default
values. This is wrong.

The change is to ignore these parameters if they are not specified
on the command line.  This will allow the Keystone client's method,
register_cli_options, to set them to the correct default values.
If the user specifies these parameters on the command line, then
we will honor them.

Change-Id: I08974f7fea0cd0cb2a906e26c9f197209c473b9b
Closes-bug: #1767144
2018-05-04 23:07:43 -04:00
huangsm caaebdc257 Modify Default Domain
From 2016/10, there is no domain with id 'default' in keystone.
And the user would create a domain whith name 'default', like this:
https://docs.openstack.org/mitaka/install-guide-obs/keystone-users.html
If a user do not specify domain_id and domain_name, it is appropriate to set
the default domain with name 'default'.

Change-Id: I4a8ff3e06362e8034eb84b0a26d8400fc733292a
2017-05-15 11:29:30 +08:00
ForestLee 0b63a8d6a7 delete bash_completion in subcommand
There are two "completion" in the subcommand table: bash-completion
and bash_completion. but "bash_completion" is not in help information
and it is repeated with "bash-completion", so delete it.

Change-Id: Ia00061376daabeacd524b1afb01e2e9a585ac56f
Closes-Bug: #1670123
2017-04-21 20:13:48 +00:00
LiuNanke 6776dd66ac Make method import_versioned_module work
Oslo.utils 3.17 provides similar function, just use it.
For more information:
[1] http://docs.openstack.org/developer/oslo.utils/history.html

Change-Id: I77b0517422569f9ef559b2cf7c7d954713c74de5
Closes-Bug: #1627313
2017-03-14 09:59:46 +00:00
Jose Phillips 12c70b72d0 Fix Murano client to use V3 and MultiDomain Authentication
This fix will going to allow the usage Murano client with V3 Authentication
and multidomain environments.

Based on the latest template of RC where is used os_user_domain_name
instead of os_project_domain_id or os_user_domain_id.

if this variables doesn't exists will going to use the old method that was
working on older versions.

Change-Id: I420a6d825fe228279fb21bcdd5c172c9fc6369f5
Closes-Bug: #1600181
2016-12-20 17:18:29 -05:00
Steve Martinelli 9283ededba move old apiclient code out of openstack/common
As part of the first community-wide goal [1], teams were asked
to remove the openstack/common package of their projects
if one existed. This was a byproduct of the old oslo-incubator
form of syncing common functionality.

The package, apiclient, was moved to a top level location
and cliutils was moved to the common module. There are no oslo
specific libraries, the recommended solution is to move it
in tree and maintain it there.

[1] http://governance.openstack.org/goals/ocata/remove-incubated-oslo-code.html

Change-Id: Ic6447da0ab3be843d231f9761d1767ed77fd81a2
2016-11-08 10:35:15 -05:00
Nam Nguyen Hoai 1385db4492 TrivialFix: Fix typo in the bash shell file
Change-Id: I8dc5ec0e9352f5296bf758ad7bc3dbda2dee669a
2016-09-30 13:51:46 +07:00
Kirill Zaitsev 9f8e6c3286 Populate tenant information in client
Python-muranoclient uses tenant id when talking to glare to avoid
importing the same package twice. However tenant information was not
available in the CLI and tenant id defaulted to None.
This led to a situation, where it was possible to
import the same package multiple times if it was not public.

This patch fixes the issue by acquiring package information from
keystoneauth or from user-supplied values in case no-auth is enforced.

Murano dashboard was not affected by this issue.

Change-Id: I72ad006c76945bf5707172ab128a89f1f6a7b112
Closes-Bug: #1624943
2016-09-19 11:44:03 +00:00
Kirill Zaitsev 0df84c053f Deprecate usage of 'glance' for --murano-pcakages-service
Change-Id: I146198f3f699a620a9650d8281d1ea11b351e540
2016-09-07 03:15:43 +03:00
zhurong df7ecbc290 Fix client could not init glance client
Now the client can not initialise glance client,
give the warning msg like:
# murano environment-create test-env
Could not initialise glance client. Image creation will be unavailable.

Have two issue about this:
1. can not get the endpoint correctly, the get endpoint
are all murano's endpoint. This is due to when get the endpoint, if have
the endpoint, will return this endpoint directly.
2. Get the correctly endpoint, init the glance client, give the error:
TypeError: "__init__() got an unexpected keyword argument 'endpoint_type'"
This is due to 'endpoint_type' argument.

Change-Id: I87df369eecc9b79cb7173967729351f7e601edc0
Closes-bug: #1594731
2016-06-21 12:30:19 +00:00
Alexander Tivelkov 6714803173 Utilize enpoint_type argument for client creation
Type of the endpoint (defined either as a --os-endpoint-type command
line parameter or OS_ENDPOINT_TYPE environment variable) now affects
which interface will be used when connecting to murano, glance and
glare apis.

Change-Id: I2033b2c122581b56ce063688c5eca99006a421fe
Closes-bug: #1590511
2016-06-09 15:21:04 +00:00
Yosef Hoffman a6775a2200 Modified docstrings to comply with pep8 H405 style check
Change-Id: I2d866d3df0d3a475b88b84518350637f9a16eb71
Closes-Bug: #1563270
2016-06-06 13:43:11 +00:00
Nikolay Starodubtsev 3341f48862 Fall back to glance API v1
In murano client we've used glance client v2, so image update worked
incorrect. Now it's necessary to fall back to glance api v1, since v2
doesn't support some needed abilities.

Change-Id: I1b0d6c9dd4075cd44133ef5111192fa602406cf2
Closes-Bug: #1572492
2016-04-21 11:58:43 +03:00
Konstantin Snihyr 45744a16d4 Set "glare" as valid choice for "--murano-packages-service" option
This commit adds "glare" to valid choices list for option
"--murano-packages-service". This value is already supported in
client's code but not allowed in CLI.

Change-Id: I4976711d3cec1f7799f34c60500193d4ecd2a6b2
Closes-bug: #1561072
2016-03-24 14:02:57 +00:00
Konstantin Snihyr e0da03f978 Fix authentication in glare-api via keystone.
If auth-token not provided by user (via env or command-line api),
murano client should retrieve token from keystone and pass it to
glance client.
Also, glance HTTPClient ignore kwargs 'username' and 'password'.

Change-Id: Ib0ccda1a2becf4ea37cc03adff01fe5941140e9e
Closes-Bug: #1560403
2016-03-22 13:45:46 +03:00
Jenkins fb9a7fec53 Merge "Add reauth if token is expired and username/password are available" 2016-03-09 15:26:43 +00:00
Jacek Tomasiak 188b81704e Add reauth if token is expired and username/password are available
If client is started with both auth token and username/password, token
gets higher priority and username/password are not used even if token
is invalid/expired.

This change switches muranoclient to DefaultCLI auth plugin which
removes some redundant code from murano and enables joint handling of
token and username/password with fallback option in case of expired or
invalid token.

This change applies only to Session mode and not legacy HTTPClient.

In addition the change contains local fix for keystoneclient bug #1551392
to avoid dependency on change Ic0fcde67fb2e6e2e5ff7506eab3fd29e25fc76e8.

Change-Id: I9ee326febb9bbdcf7279a35a696ecc58293d70f7
Closes-Bug: #1499329
Related-Bug: #1551392
2016-03-09 13:59:02 +00:00
Kirill Zaitsev c093404b7e Distinguish between glance and glare endpoints
Since glare has been moved to a separate service (instead of being
glance v3) muranoclient has to distinguish between glance and glare.

This commit adds a glare-url parameter, that is used for glare artefact
client

Change-Id: Ief54eb0b3e0bf6def7cee1e2d75f8aebaf113466
Closes-Bug: #1551733
2016-03-02 22:25:04 +00:00
Jacek Tomasiak a9dd96e4c8 Remove unexpected kwargs when authenticating using token
Current implementation of token auth in CLI doesn't work at all.
_get_keystone_auth() is handling all types of authentication and gets
a superset of all possible inputs as kwargs.
Token authentication doesn't expect some of the arguments which results
in "__init__() got an unexpected keyword argument" errors.

This change keeps the "facade" function but passes only parameters
which are expected by Token() constructor.

Change-Id: Ib71ce1523f60df340c3b939f646c5b33bf0b146d
Closes-Bug: #1545187
2016-02-17 18:01:59 +00:00
Omar Shykhkerimov 8f37884768 Deletes redundant line in shell.py file
Change-Id: Ic3b7a7052a147234eb961f74afbe23af6c6b1ce3
2016-02-16 19:42:40 +02:00
Jacek Tomasiak ffa0fe4431 Fix checks for Project/Tenant command line arguments
OS_PROJECT_ID/OS_TENANT_ID and OS_PROJECT_NAME/OS_TENANT_NAME are
supposed to be used interchangeably. Current implementation doesn't
handle this properly. It requires "tenant" parameters to be present
even if "project" arguments are provided. The check is done twice
which is redundant, inconsistent and catches some paths which don't
require those arguments at all.

The redundant check has been removed and better of two available
checks has been moved to proper place in the code.

Change-Id: I7f435aedf40fa16af8417c21d778efc0c70979d6
Closes-Bug: #1545182
2016-02-13 08:15:40 +01:00
Alexander Tivelkov bc6f50407f CLI shell can now properly interact with Glance Artifacts
Since murano packages can now be stored in Glance Artifact Repository
the client needs to be instructed which service to query for them.
Appropriate argument was added to python client, however it was not
set from the shell for the CLI usage.

This patch adds appropriate command line argument to the shell script
and adds ability to instantiate artifacts_client to be passed to
muranoclient as an option.

Change-Id: I2aabc2c98ee001dfe42dbc5c6d50cb279a5a10ce
Closes-bug: #1537010
2016-01-22 16:20:54 +03:00
Aaron-DH 15bf8b5468 Delete unuse variable in shell.py
Variable 'kwargs' is declaration in each judging conditions,
remove the unuseful declaration

Change-Id: I830c9d264ef88ec96de38bdb70ee634179f1d15c
2016-01-15 14:19:09 +00:00
Lin Yang 0d4e668ca7 Remove unnecessary statements for default argument
Change-Id: Ifb39ca1de25aa9ce10211441e618544d225ddd8e
2016-01-13 16:14:23 +08:00
Steve Martinelli 4e3bc8ead7 use keystoneclient exceptions instead of oslo-incubator code
depending on any oslo-incubator code from another project is
dangerous. keystoneclient makes its exceptions public and it's
not recommended to use any code from
keystoneclient.openstack.common.apiclient since it's maintained
by oslo-incubator.

Change-Id: I869a351988354059931e132cea17b80147dffd0e
2015-12-27 01:47:44 -05:00
liyingjun 4b4d828be0 Replacing application_catalog with application-catalog
Murano does not get keystone endpoint when Keystone is configured to use
templated catalog

Change-Id: Ib99e649f4e2dc750043ee025fd56d2fef8486a8c
Closes-bug: #1514692
Depends-On: Id568c0a59b2e99dc946b1f2f55f6b233fd6a1b27
2015-12-01 13:51:43 +00:00
Nikolay Starodubtsev c60feee45c Add keystone v3 support to client
All clients should support keystone v3 till kilo. This patch adds
support for keystone sessions, keystone endpoint discovery and support
for the CLI to provide keystone v3 options. Also, bumped glance client
API version to 2 for the compatibility with v3 keystone API.

Change-Id: I565927db7f393c0bae41ebf9c03488f9cd966e79
Co-Authored-By: David Hu <david.hu@hp.com>
Co-Authored-By: Steve McLellan <steven.j.mclellan@gmail.com>
Closes-Bug: #1354129
Closes-Bug: #1507932
Implements: blueprint support-keystone-v3
2015-11-09 16:01:55 +03:00
Jenkins beb66510e2 Merge "Update MURANO_REPO_URL" 2015-09-22 19:43:47 +00:00
Kirill Zaitsev 3d22f612cd Update MURANO_REPO_URL
Updating MURANO_REPO_URL to 
http://apps.openstack.org/api/v1/murano_repo/liberty/

Depends-On: Icb869e9ac8e9795e93d8922600d900522b759e08
Change-Id: I8f7fe9c75798868d9bb435757c1a4d05841ccd63
2015-09-22 12:11:31 +00:00
xiangxinyong 48377e5081 Output detail informations about murano --debug command
For example:
* murano environment-list
* murano --debug environment-list
These two commands have the same informations print in the CLI at present.
* murano --debug environment-list
This command should include request and response informations in the CLI.
As bellow:
curl -i -X POST -H 'X-Auth-Token: 2d3cafec806d44fbbf44dd9f19778a1e' -H
......

Change-Id: I3da0c33adfebcbae00ccdfa9f5eaca9a2d3cb662
Closes-Bug: #1497890
2015-09-21 17:52:58 +08:00
Timur Nurlygayanov 1141dd59af Fixed issue with cacert parameter
We need to use parameter cacert instead of ca_file parameter
to work with CA certificates like python clients for other
OpenStack services.

Also fixed typo (after copy paste from Glance code).

Change-Id: Ibe36390aab2f2edb0fe7670f76f61caeb350d34b
Closes-Bug: #1487099
2015-09-02 17:18:28 +03:00
xiangxinyong 624221180f Standardise help parameter of CLI commands
When typed the command like bellow,
some parameters help have a full stop(.), and others have not.
murano --help
--version    show program's version number and exit
--include-password    Send os-username and os-password to murano.
--murano-repo-url MURANO_REPO_URL
            Defaults to env[MURANO_REPO_URL] or
            http://storage.apps.openstack.org

Change-Id: I893654efe2aeac08fb8b2621cf29ad95ca16a113
Closes-Bug: #1488345
2015-08-26 12:45:10 +08:00
Nikolay Starodubtsev 2f986f77f8 Switch to oslo_log in murano client
Change-Id: Ie3614eb3f5f7e4c1177524c16f6741838e3a9c63
Partially-bug: 1463093
2015-07-27 14:45:46 +03:00
leizhang b1ae628a84 Add --version parameter for murano python client
Change-Id: If2d04dc1a62849a3713b233444f98b9d638cdc11
Closes-bug: #1450634
2015-06-22 16:01:45 +00:00
Kirill Zaitsev d2182e1b92 Point default MURANO_REPO_URL to http://storage.apps.openstack.org
Change-Id: I678554b223fac982d97c8196fe661ff861b40474
2015-05-21 17:03:41 +03:00
Doug Hellmann 1bb107cf0d 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: I5d325e9397404211df00d9e39195b63d9a2f2e76
2015-05-06 19:37:48 +00:00
Kirill Zaitsev 1f47d2cfff Add bash-completion subparser to shell client
Fixes previously non-functional bash-completion commmand

Change-Id: I550a8f7f9fa348070f7e9777832943d451fd789f
Closes-Bug: #1439702
2015-04-02 16:46:26 +03:00
Kirill Zaitsev 82a1d10162 Add support for required images file
If a package contains a file with a list of required images
check if they are present in glance and attempt to download them
if not. Supports v1 glanceclient only.

Change-Id: Ibb39fbbadef109b117094afefd383fe24de0a792
Partially implements: blueprint muranoclient-marketplace-support
2015-03-13 12:29:10 +00:00
Kirill Zaitsev cc9dc07353 Allow importing packages name
Extend PackageManager.create to allow
importing from external repository by name.
Repository base URL can be set with cli option or env var.

Change-Id: I3107d9319183c11b324753bb96a8082ad7c4e9fb
Partially implements: blueprint muranoclient-marketplace-support
2015-03-12 18:30:50 +03:00
Andrew Pashkin da25e71b68 Reverted "Add keystone v3 support to client"
Reverts 90c05dc70c

It broke functional tests in murano and because of that
it was reverted.

Change-Id: If45cc114ca89fb0df80d6889fad34578c092e2d6
2015-03-03 13:22:15 +03:00
Steve McLellan 90c05dc70c Add keystone v3 support to client
All clients should support keystone v3 in kilo. This patch adds
support for keystone sessions, keystone endpoint discovery and support
for the CLI to provide keystone v3 options.

Bumps python-keystoneclient to >=0.11.1 to bring in session support.

This patch was previously dependent on a separate one to add session
support but that work has been squashed into this and its review
(https://review.openstack.org/#/c/131309) will be abandoned.

Change-Id: I277008c1092b3e1abbbb3f76eb1bb36123f928be
Co-Authored-By: David Hu <david.hu@hp.com>
Closes-Bug: #1354129
Implements: blueprint support-keystone-v3
2015-02-12 21:18:20 +03:00
Ekaterina Chernova 47c755f31e Use modules from oslo istead of openstack-common
Change-Id: Iaf6c3624e38db17e1f6e13bd5c1c2f236487544b
2015-01-20 12:19:23 +00:00
Serg Melikyan 7ee1c39dd6 Revert "Add keystone v3 support to client"
This change broke package.create feature of python-muranoclient

This reverts commit 65f51420e5.

Change-Id: I52af65d954ea2ff46a012026190b21ab1bdf75d7
2014-12-13 00:32:45 +00:00
Steve McLellan 65f51420e5 Add keystone v3 support to client
All clients should support keystone v3 in kilo. This patch adds
support for keystone sessions, keystone endpoint discovery and support
for the CLI to provide keystone v3 options.

Bumps python-keystoneclient to >=0.11.1 to bring in session support.

This patch was previously dependent on a separate one to add session
support but that work has been squashed into this and its review
(https://review.openstack.org/#/c/131309) will be abandoned.

Co-Authored-By: David Hu <david.hu@hp.com>
Change-Id: I0f4931f1e6566a7b83280302f884248c8db909c5
Implements: blueprint support-keystone-v3
2014-11-21 09:38:20 -06:00
Christian Berendt 29f37787de Bump hacking to 0.9.x series
Change-Id: I83f6b95a6f756d7eaec264a8d591cb2f128fabb1
2014-08-14 14:14:36 +04:00
Ekaterina Fedorova 1a7db5f125 Infrastructure update
* Update Openstack common (aa7c658156e1e46315cdce1d580718f30054da2f):
- apiclient
- importutils
- strutils
- jsonutils
- cliutils
- apiclient
* Switch from nosetests to testtools
* Update shell.py to the actual state
Change-Id: I2b8f3393ba3e700f65f1a794caae713f12856035
2014-06-24 13:28:36 +04:00
Alexander Tivelkov 0364228676 Improve logging in CLI client
Do not output the INFO messages into the Console
Proper output of exceptions
"Wrong-Version" message displays proper service name
(we are grateful to Glance for providing a copy-paste source :)
but let's still call our service Application catalog, not Openstack Images )

Targets-blueprint: murano-cli-client

Change-Id: I484fa4d494584472f705fdffc35e2dc70f1f3e8a
2014-05-30 13:51:33 +00:00