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 8868671fd5 Remove six usage muranoclient/common
Change-Id: I7f27bc87c8ea098b70ab530d6857c927a571e930
2020-04-16 19:49:09 -07:00
Andreas Jaeger 787a6ac607 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 2.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Change-Id: I5cb9b15a3391bf32bb6e43958f8f6ffbcd6bcf07
2020-03-30 08:19:47 +02:00
M V P Nitesh 3e70d5be31 Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
2.In py2, the performance about list should be negligible, see the
link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ib3740617715c7097efeb5852338a669dc0bf8ff7
2017-04-04 17:29:58 +05:30
Jenkins c1c64f8511 Merge "Replaces uuid.uuid4 with uuidutils.generate_uuid()" 2017-04-01 19:47:45 +00:00
melissaml d90ef0950d Replaces uuid.uuid4 with uuidutils.generate_uuid()
OpenStack common has a wrapper for generating uuids. We should
use that function when generating uuids for consistency.

Change-Id: Ie6c8ac0d70e200f60415e720bc0f94980ec11147
2017-03-22 12:14:44 +08:00
luqitao bd20b2dbbf Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I2b70b72ac633c559e7ad366d6a1c1763aebf562a
2017-03-21 02:50:06 -04: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
LiuNanke 3a7135516c Support i18n for LOG.warning
log warning msg with _LW(), to support i18n translation.

Change-Id: I17b1eeec286d34ce2ebddfb9c4251707af2e2e53
2016-12-06 23:06:43 +08:00
sslypushenko a5873de0ba Add validation to package import
Patch added validation to both CLI and UI. Validation triggers
only manifest checks in order to be executed quickly. To run full set
of checks CLI tool murano-ppkg-check should used.

Depends-On: Iae6b56b2f7d32c75515ee92f0e33f9e3af9924e9
Change-Id: I94e395c09483dc2b5061df75c952bc87f60327aa
2016-11-04 07:59:33 -07:00
Omar Shykhkerimov 5b677b2abc Add opportunity to import package from directory
Change-Id: I23cdc5c6bfbf46fc0ca1149caeaf0bc43b2f7829
Closes-bug: #1620984
2016-09-20 15:56:37 +03:00
Andy Botting 9142eebe03 Decode PrettyTable output before printing for Python3
In Python3 the pretty table output is a binary type (encoded)
so print function output looks like

b'+-----+-----+\n| foo | bar |\n+-----+-----++\n

instead of

+-----+-----+
| foo | bar |
+-----+-----+

This commit adds a PY3 check and decodes the output before printing.

This brings Murano client in line with other clients which have this
fix already (e.g. Nova, Heat, Cinder, etc)

Change-Id: I102c28828a3ec96266600dd82dcddd8bcf42318d
2016-08-24 09:55:03 +10:00
Alexander Tivelkov 98adda6a46 Support for multi-class yamls in client
MuranoClient needs to analyse package classes (names and inheritance
chains) to properly add packages to Glare. This requires it to
properly resolve class names in the appropriate namespaces.

Since Mitaka Murano supports multi-class yamls, i.e. yaml files
containing multiple MuranoPL classes in a single yaml file using it
multi-document format. Optionally this allows to reuse a single
namespace definition for multiple classes defined in the same file.

Client was not aware of this feature, always loading classes as
single-document yamls. It was also always using the current-class
namespace definitions, thus likely to fail if the shared namespace
definition is in use.

This has been addressed.

Closes-bug: #1608440
Change-Id: Ibd08454f71e0266c76a2ac517b441df97311d8b9
2016-08-01 18:41:06 +00:00
Kirill Zaitsev b7a5c74400 Use DummyYaqlYamlLoader to load classes during upload
This commit changes the loader, that loads MuranoPL classes during
package upload to DummyYaqlYamlLoader. This would allow importing and parsing
packages that contain '!yaql' tag without any errors, when importing to
glare.

Change-Id: I9071bb479019cac20bf61f110154082063c9d777
Closes-Bug: #1586028
2016-06-24 00:59:34 +03:00
Kirill Zaitsev cd182ba363 Use yaml.SafeLoader instead of yaml.Loader
Before this patch yaml.Loader was used by the client to create custom
yaql-enabled yaml loader. It is unsfae do to so, because yaml.Loader is
capable of creating custom python objects from specifically constructed
yaml files.
UI parsing functions also fell back to yaml.Loader if
the custom loader was not supplied.
After this patch all yaml load operations are performed with safe
loaders instead.

Change-Id: Id9bb6eabda35522271ec394f8758a974878cbb4b
Closes-Bug: #1586078
2016-06-23 18:26:23 +03:00
Valerii Kovalchuk a4c351cb47 Import package and dependencies in correct order
Package and its dependencies are being imported in random
order which allows to import package and then get an error while
importing its dependency.
This patch uses OrderedDict ordered by topological sort instead
of regular dict to fix that.
Cyclic requirements are imported in random order.
Tests to check order of import are also added.

Change-Id: Ia6cb087679b3ae4613ac3d1d19279a9826e537ef
Closes-bug: #1585420
Co-Authored-By: ksnihyr <ksnihyr@mirantis.com>
2016-06-21 14:04:13 +03: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
Junyuan Leng 2f4cefcae7 Typo fix for python-muranoclient
Fixed several typos in python-muranoclient source code comments.

Change-Id: I6321403d6dd550a7a764d98c5faaddc320c8857e
2016-04-12 11:47:06 +08:00
zhurong 5af45cb158 Import bundle with a not regular-bundle json give no error
Use bundle-import import a not regular-bundle json file, no error output.
Here should give the error: 'Can't parse bundle contents'

Change-Id: Ice069f0e9a4caa51c1bfc8a1fffb89647250aba9
Closes-Bug: #1550196
2016-02-26 08:37:12 +00:00
venkatamahesh 4439e0aee0 Fix spellings for some words
change occured to occurred
       retreive to retrieve

Change-Id: Ib1f01275de049a842828e37edf42def24ea03689
2016-02-03 15:34:00 +00:00
srushti 1ba5d55103 Fix module's import order
Made corrections in import order for built-in,third-party
and project specific modules as per openstack import
standards [1].

[1] http://docs.openstack.org/developer/hacking/#import-order-template

Change-Id: I1e086ab187aaf31868fcce76917070bb9a95e870
2016-01-21 22:10:58 -08:00
Ravi Shekhar Jethani 8c90b56312 Add python 3 support
Used six.iteritems, where relevant.
Used SimpleHTTPServer, ConfigParser from six.moves
Replaced iter.next() with next(iter)
Replaced dict.keys()[0] with list(dict.keys())[0]

This patch was generated by the following tool using
'all' option.

https://github.com/haypo/sixer

Command:
python sixer.py -w all muranoclient/

Blueprint client-py34-support
Change-Id: I1cc978f13ac6ea2f0d33b1027362102c6c77ca6e
2016-01-19 04:30:22 -08:00
zhurong f5bc968af0 Remove arguments "{}" and "[]" in function definitions
remove mutable default arguments "{}" and "[]" in function definitions
refer to:http://docs.python-guide.org/en/latest/writing/gotchas/

Change-Id: Ib92d75f7172c97d07e22b59991a513d2f84783f3
Closes-Bug: #1527080
2015-12-19 01:00:39 +08:00
zhu.rong 0b413d8140 Use oslo_i18n instend of gettextutils
use oslo_i18n instend of gettextutils

Change-Id: I429a72c0aeebcee779c45c8e284620f032bca0e7
2015-12-14 12:46:53 +00:00
Kirill Zaitsev 1627a5a24f Add python 3 support
Use six versions of StringIO, urllib and raw_input
Use BytesIO instead of StringIO, where relevant
Added ability to distinguish binary and non-binary modes in utils.File
Use six.b for lyterals where relevant
Use six.iteritems, where relevant

Targets blueprint: client-py34-support

Depends-On: Id0e92840eb896ed487aafdcc39074aedefb55dda
Change-Id: I78a914cd77da7263d2bd0f871b8a478b5adadaee
2015-11-11 20:32:17 +00:00
Olivier Lemasle a9d664886a Import images publicly when package is public
When using "package-import --is-public" to import a Murano package,
make sure glance images automatically imported are also public.

Change-Id: I9460360e84cc40d7414aa5cd9f7367f5a80b8466
Partial-Bug: #1507139
2015-10-30 12:02:26 +01:00
Kirill Zaitsev b0a5b4a98c Use non-absolute paths, to allow urljoin join them correctly
Change-Id: I530f7f43ae69e82fd0db68015165b86ba61e5ce2
Closes-Bug: #1503593
2015-10-08 17:11:33 +03:00
zhu.rong 393cc984fe Fix the common/utils typo
Fix a typo in common/utils.py

Change-Id: Ib4ec0b1e51d21ff521e4103327b9c3fe9b1f5ef2
2015-10-02 17:21:58 +08:00
Stan Lagun 9978fc0e53 Fixed YAQL tag leakage to YAML loader
This is the same fix as in https://review.openstack.org/#/c/199109/
This code was copied to python-muranoclient from murano but was
fixed then only in one place. Despite the bug exist for many releases
it didn't affected murano until recent changes to HOT translator
(or at least it was never reported)

See https://review.openstack.org/#/c/199109/ commit message
for more details

Change-Id: I910f4117050430433fd9fdd291f0ba9659f75825
Closes-Bug: #1501570
2015-10-01 05:17:14 +03:00
Alexander Tivelkov 54918f51a9 Added the support of Glance Artifact Repository
This patch adds a support of 'Murano Package' Glance artifact type to
the murano client. The ArtifactRepo class wraps the standard Glance's
V3 client and provides access to Glance Artifacts as to Murano
Packages.
Another class, called PackageManagerAdapter provides a temporary
facade which makes artifact-based packages compatible with the legacy
packages.

Depends-on: I11efa3758cea5eb459a101d62c93355f34bb42f9
Change-Id: I35d71bb7c03b23b01722e060c3ef770a24168ada
Implements-Blueprint: artifact-repository-support
2015-09-03 10:39:45 +00:00
Kirill Zaitsev e59267f48e Support for YAQL 1.0.0
Adds support for yaql 1.0.0, while retaining backward compatibility with
yaql 0.2.x

Co-Authored-By: Ekaterina Chernova <efedorova@mirantis.com>
Partially implements blueprint: migrate-to-yaql-vnext
Change-Id: I7f314634ab5f08a521e51082d5c84dffca4b0b5c
2015-08-21 10:01:12 +00:00
Kirill Zaitsev c7ee92ca84 Generate ids in environment-apps-edit command
This commit adds helper function, that traverses resulting object-model
before sending it to API and replaces any occurances of ===id1===,
===id2===, etc. with generated uuids.
Helper function keeps track of already generated ids.

Targets blueprint: env-configuration-from-cli

Change-Id: Iea20a2601a5dc4b8f92c3e935074ac2d7828d005
2015-08-14 13:00:22 +00:00
Kirill Zaitsev 658db22500 Add params to environment_show command
Adds 2 params to environment_show:
* --only-apps: only show apps of the environment, without any
  frame or additional formatting
* --session-id: allows listing of environment services of a specific
  configuration session

Targets blueprint: env-configuration-from-cli

Change-Id: I55d33a9b8cd0e19d26ed76f4a5524a70795a2251
2015-08-10 14:26:48 +03:00
Jenkins 3833820393 Merge "Add bundle-save CLI command" 2015-08-05 17:25:53 +00: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
Dmytro Dovbii 0a7999c7ab Add bundle-save CLI command
There are situations when user doesn't have access to the Internet
from his cloud with murano. Patch adds new command to client allowing
user to download bundle of packages with dependencies

Partially-Implements: bp bundle-save

Change-Id: I1cc2b745b60681de9494aa2d14e54fcb807f29eb
2015-07-27 12:02:06 +03:00
Ekaterina Chernova af0a55cb81 Remove hash check during image upload
There were situations, when image was upload twice automatically,
because it was updated and it's hash changed.
But since these images have the same name and some of our applications
currently rely on image name, when constructing heat template it caused
problems in heat, as it could not resolve this situation,
while deploying template, generated by Murano.

Change-Id: Ib8f86f4934b2420d3c1c7e952dcbb47bcc9ab81c
Closes-Bug: #1443936
2015-05-14 21:14:15 +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 d34002c0be Improve image and bundle handling
Bundles now have a .bundle extension when importing by name
Error/success reporting for bundles, packages and images improved
greatly

Change-Id: I4dee6a3c4ce9e873ad97a2edd682102fa0d0478b
2015-03-23 17:22:59 +03:00
Kirill Zaitsev 279e83e5a4 Support local bundles
If the bundle is being installed from a local file
first attempt to search for files in the folder, relatvie
to the directory of the bundle, next check the URL attribute and
finally check repository. Same for requirements and images.

Change-Id: I8a40ad274e60d97111602bdd0d7b08eb39126a6d
2015-03-19 19:23:48 +03:00
Kirill Zaitsev 32352d30cb Enable Bundle.packages() to yield Package objects
Now Bundle.packages() generator returns Packages and .package_specs()
returns package specification dicts.

Change-Id: Ic3a6c8bc8d941115324cc15b41abbbf0d68abcd4
2015-03-16 11:29:46 +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 8cf2c71459 Client support for Require section in manifest
Support for parsing of Require section of manifest.yaml
Recursively downloads required packages, keeping track of
all dependencies. It is later possible to reuse downloaded packages
for package creation.

Change-Id: I0ae9dc1226439855e4196970df39071c96f30db4
Partially implements: blueprint muranoclient-marketplace-support
2015-03-13 11:33:16 +03:00
Kirill Zaitsev 45ea1baf98 Allow importing bundles of packages
Add bundle-import command to allow importing
bundles of packages from local files,
urls or base murano repository.

Change-Id: Ia51fdb242f5730af69dc6825fd48bc7e2e695968
Partially implements: blueprint muranoclient-marketplace-support
2015-03-12 18:36:16 +03: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
Kirill Zaitsev 860f70d437 Allow importing packages by url
Extend PackageManager.create method to allow
importing from external http/https servers,
maintaining backward compatibility with local file imports

Change-Id: Ibc530f0d0794b8e9fa7dcbc9ff4ead190f5eefd4
Partially implements: blueprint muranoclient-marketplace-support
2015-03-12 16:21:54 +03:00
Ekaterina Chernova 47c755f31e Use modules from oslo istead of openstack-common
Change-Id: Iaf6c3624e38db17e1f6e13bd5c1c2f236487544b
2015-01-20 12:19:23 +00:00
Christian Berendt 29f37787de Bump hacking to 0.9.x series
Change-Id: I83f6b95a6f756d7eaec264a8d591cb2f128fabb1
2014-08-14 14:14:36 +04:00
Ekaterina Fedorova d62b0f2d6e Add package-create command
This command composes application package from heat
templates and for muranoPL classes. Manifest file
is generated automatically. For a list values, such as
tags and categories comma is used.

Partly-implements: blueprint murano-cli-client

Change-Id: I6005bf24761e5537681156fe4fa17bcc11bc7501
2014-07-03 19:32:11 +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