Commit Graph

1410 Commits

Author SHA1 Message Date
zhurong 68d653af0a Fix bandit
Change-Id: I664a6c22b6b68cd2ea0ffcae1b8242fa7d61f14e
2023-04-25 02:46:44 +00:00
zhurong b68a216bb7 Fix tox 4 compatibility
Change-Id: I6bb3ef7ea197a7dfc384991c17e526c23e4b2fed
2023-03-03 01:27:07 +00:00
Andy Botting 60f305aca5 Fix murano-test-runner help output test
Due to slight differences in the --help output text for the test
runner, the output comparison no longer matches once you get past
python 3.8.

This fix cleans up the help text itself, and modifies the test to
only match on some specific elements, not the whole thing.

This should make the test less fragile going forward.

Change-Id: I7b94d8ae9eb58c43676ae3171c0f6193496c6d4b
2022-10-14 16:05:18 +11:00
Andy Botting dc89e7cf61 Fix compatibility with Python 3.10
Since testing with Python 3.10, the test
  murano.tests.unit.dsl.test_helpers.TestDSLHelpers.test_weak_ref
was failing with
  testtools.matchers._impl.MismatchError: 'weakref' != 'ReferenceType'

This is simply the result of newer Python being more correct about
the name of the weakref ReferenceType.

The fix here is to ask what the name is of the class and use that
instead of the hardcoded 'weakref' name.

Change-Id: I26ea4750f10dedb04a07d188e57fcd391a28f870
2022-10-12 21:25:08 +11:00
ljhuang 98cdff796c Replace abc.abstractproperty with property and abc.abstractmethod
Replace abc.abstractproperty with property and abc.abstractmethod,
as abc.abstractproperty has been deprecated since python3.3[1]

[1]https://docs.python.org/3.8/whatsnew/3.3.html?highlight=deprecated#abc

Change-Id: I953dd0787326ad5e2d0867f6c29e9a3d4c100d22
2022-10-12 04:56:01 +00:00
Thomas Goirand 46b34c05b0 Fix compatibility with oslo.db 12.1.0
oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However, we
are currently relying on the autocommit behavior and need changes to
explicitly manage sessions. Until that happens, we need to override the
default.

Note that this patch was written using this one as example:
https://review.opendev.org/c/openstack/magnum/+/858374

Also include Zuul gate fix. Fix as described in [1][2]

[1] https://lists.opendev.org/pipermail/service-announce/2022-September/000044.html
[2] https://lists.zuul-ci.org/pipermail/zuul-discuss/2022-May/001801.html

Change-Id: I963e741078514b1cca6ed0e510cefaeccdd3499a
2022-10-12 13:11:52 +11:00
OpenStack Proposal Bot 4434b57486 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I818e9704c0e0881ffaa545564880b962c9e38fe0
2022-06-21 03:19:18 +00:00
Andy Botting 411d0f85e8 tests: Remove use of 'oslo_db.sqlalchemy.test_base'
The various test cases and mixins in 'oslo_db.sqlalchemy.test_base' have
been deprecated since oslo.db 4.34.0 (March 2018). Remove use of these.

Change-Id: Ic4ba41e61de3a33d6779b53bb0274e5e115e335a
2022-04-19 09:15:59 +10:00
Jeremy Stanley 398b2d86d5 Tenant to project migration for RequestContext
As of the oslo.context 4.0.0 release, RequestContext objects no
longer have a tenant attribute, instead expecting callers to use
project_id for that purpose. Update all context.tenant references to
context.project_id in order to facilitate this transition.

Change-Id: I2830ccf840bf4d1d8a516287adee51c46d2a5583
2022-03-29 12:43:00 +00:00
zhurong af5a48d282 Fix Engine.execute() in func tests
Change-Id: Iaf443954e2e41fb7c03ea3dc81b53f439531742b
2021-10-16 02:30:34 +00:00
Zuul 1a32af3d8a Merge "Replace deprecated import of ABCs from collections" 2021-08-22 04:09:36 +00:00
Takashi Kajinami 4193e28ddd Revert "Use fnmatch from oslo.utils"
This reverts commit 4fbe4ee433.

Reason for revert:
The oslo_utils.fnmatch module was added to solve an issue in py2.7 but
it is no longer required because py2.7 is no longer supported.
The module was deprecated since oslo.utils 4.9.1[1] and the stdlib's
fnmatch module should be used instead.

[1] 4c893c92f551c9dd2a7cfbe7ae8171ad8139df0b

Change-Id: Ic35ab4936d82e07493ecd5f81e6e46a84dc6546c
2021-08-18 14:22:44 +00:00
Takashi Kajinami 181d09d05f Replace deprecated import of ABCs from collections
ABCs in collections should be imported from collections.abc and direct
import from collections is deprecated since Python 3.3.

Change-Id: Ifb983fa478120a95760bf0cb78994210acdbe8e8
2021-08-02 08:27:12 +00:00
Takashi Kajinami 2800f0b62c Fix broken unit test
This change mocks sqlalchemy.update during unit tests properly to avoid
the following error.

sqlalchemy.exc.ArgumentError: subject table for an INSERT, UPDATE or
DELETE expected, got <MagicMock name='models.Instance' id='...'>

Closes-Bug: #1938676
Change-Id: I5268132018e0a283bd35b5599cf8ca41968dde93
2021-08-02 17:22:43 +09:00
Ghanshyam Mann 1c87ebf9a8 [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:

1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.

2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.

Also replace policy.json to policy.yaml ref from doc and tests.

CONF object needs to be initialized before policy enforcer(). That
need to remove cfg.CONF.unregister_opts from TestAuthUtils cleanup
as this is taken care by cfg.clear() with proper workflow otherwise
it end up with error
"oslo_config.cfg.ArgsAlreadyParsedError: arguments
already parsed: reset before unregistering options"

- https://b132754ee7062a9ab187-9add4719a9922a9385555a8552fc2366.ssl.cf5.rackcdn.com/768520/5/check/openstack-tox-py38/7964354/testr_results.html

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: I1b6c6485bc651fd0b87244a68204036dd4aa37f4
2021-03-07 17:50:48 -06:00
Erik Olof Gunnar Andersson e5d9d1b74f Use common rpc pattern for all services
This patch introduces a common rpc pattern to ensure
that the rpc transport is shared where possible. This
helps prevent rpc connection leaks and should ensure
that we are making the best possible use of all
available rpc connections.

Change-Id: Ib42e368cfda2b148a07df0bd74046739f40f7018
2021-01-19 12:24:08 -08:00
Andy Botting 09831b64d5 Fix 'method object has no attribute __yaql_function__' on py3
This error was appearing when calling some murano methods through
YAQL functions.

The helpers.function() call was testing for im_func which was
deprecated on Python 3.

Switching to __func__ is the correct way to get the function from
a method.

Change-Id: I473283e0d5a4901ff787f434a5f5f9d923090614
2020-10-30 10:34:41 +11:00
Zuul 05c57f8933 Merge "Switch from unittest2 compat methods to Python 3.x methods" 2020-09-20 01:28:13 +00:00
Sharma-Ritika 91a58c5763 Murano testing to Ubuntu Focal
As per victoria cycle testing runtime and community goal,
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Bump lower constraints to make testing work for Focal.

Change-Id: I1fc6b0c67d767bc698e12f0e79fadd19bb7d0a8d
Story: #2007865
Task: #402198
2020-09-19 01:46:40 +00:00
zhurong fc12a87932 Fix requirements-check job
Change-Id: I169a7e5fc5d5562aac4f8c02f5ceb1843122696e
2020-08-05 09:22:03 +00:00
zhurong 371e99e473 Fix murano ci UT error
Change-Id: I24ea16ae4d853829ca34721febf8c834cc42977f
2020-08-03 01:51:33 +00:00
zhurong ae9b4e8099 Murano api add monkey patch
In this commit [0] has monkey patching should be as
early as possible, but didn't monkey patch murano api,
this will cause the RecursionError

[0]: I76fed9e80a7f848a0f6b37c25dd035844c75a6ee

Change-Id: Idf8ab02b15459d4dc786389c583afb752c599cb6
Closes-Bug: #1886784
2020-07-08 16:25:18 +08:00
melissaml 4adf454c86 Switch from unittest2 compat methods to Python 3.x methods
With the removal of Python 2.x we can remove the unittest2 compat
wrappers and switch to assertCountEqual instead of assertItemsEqual

We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: Ida67a22b153175b8517782593718b7c60f633c16
2020-07-05 19:33:17 +08:00
Zuul aac7c6b80e Merge "Fix versions api by using webob correctly" 2020-06-05 07:54:17 +00:00
Sam Morrison cd27f95c0b Fix versions api by using webob correctly
Currently getting the following error:
TypeError: You cannot set Response.body to a text object (use Response.text)

Closes-Bug: #1882156

Change-Id: Iba918ec671dabb2d0df72e071c6279176c63b312
2020-06-05 09:05:04 +10:00
Hervé Beraud 0108d030f9 Always reset cfg.CONF when starting the wsgi app
This ensures that options loaded during any prior run of the
application are dropped before being added again during init_application.

Change-Id: I16b17b7b93bed698495582c972870b3d8e3c926b
2020-06-04 12:52:37 +02:00
zhurong 7eca01a7d6 Fix pep8 error
Change-Id: I2832b70a6eeb2b9edf2124977e4be362e0eedabe
2020-05-13 14:03:53 +08:00
Corey Bryant fe543a67c7 Monkey patch original current_thread _active
Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Also disable E402 to allow the change in.

Change-Id: I508fcd0707ecdd2bf720303f6cbb4087a38aaadd
Closes-Bug: #1863021
2020-05-06 00:52:04 +03:00
Sean McGinnis 4866d54831 Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Id266a937b37507a1cef05ac34e33a80265581ad1
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Co-Authored-By: zhurong <aaronzhu1121@gmail.com>
2020-04-19 23:23:41 -07:00
Zuul 90def4e28b Merge "Remove six murano/packages" 2020-04-20 01:58:24 +00:00
Zuul 8630251ae5 Merge "Remove six murano/engine" 2020-04-20 01:58:23 +00:00
Zuul 8308ef1b5c Merge "Remove six murano/db" 2020-04-20 01:58:21 +00:00
Zuul c82d8a6c48 Merge "Remove six murano/hacking" 2020-04-20 01:58:20 +00:00
Zuul f93d1e5148 Merge "Remove six murano/dsl" 2020-04-20 01:58:19 +00:00
Zuul db007b6b60 Merge "Remove six murano/api" 2020-04-20 01:58:18 +00:00
Zuul ce0f00ec80 Merge "Remove six murano/common" 2020-04-20 01:35:54 +00:00
zhurong 8bf959f805 Remove six murano/api
Change-Id: I53368580d7a2d1923688be80899c97c57aafffad
2020-04-18 08:38:48 +00:00
zhurong 07242fc255 Remove six murano/packages
Depends-On: https://review.opendev.org/#/c/720860/
Change-Id: I88d5b21c24780223196ff3bb7c629f404c343f14
2020-04-18 01:12:08 -07:00
zhurong aa5f945088 Remove six murano/engine
Depends-On: https://review.opendev.org/#/c/720860/
Change-Id: Ib10d9e191ec93e55a0982d29de9a62a7b5d1894f
2020-04-18 01:08:08 -07:00
zhurong 91c0f48a30 Remove six murano/dsl
Change-Id: Iac776e29eb63421577cb928692f2945200f32b1d
2020-04-17 23:32:45 -07:00
zhurong 272a9e40fd Remove six murano/db
Change-Id: Ibc5a314beab903d4cd8d0bd693d8c9c134858c69
2020-04-17 20:05:40 -07:00
zhurong 070a4723be Remove six murano/hacking
Change-Id: I5b33362ccd7065c5c2890d1f1a2cb1082a29a8c2
2020-04-17 19:41:02 -07:00
zhurong d3f05df5cc Remove six murano/common
Change-Id: Iac6e4e4c1dde1b661dd3e9a0055cea6f9f11817d
2020-04-17 18:52:59 -07:00
zhurong a9e530fdd8 Remove six murano/policy
Change-Id: Iafee5f81a3c3e7930232f17c2d3c0f30764e3b47
2020-04-17 18:48:08 -07:00
Andreas Jaeger d1dae85ac7 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Change-Id: Ibe28b6b6bf3927e80816f0c5f1cb972fb6e2374b
2020-03-30 11:59:26 +02:00
Sean McGinnis 25ebd01de3
Drop unittest2 usage
unittest2 was needed for Python versions <= 2.6, so it has not been
needed for quite some time now. See unittest2 note on:

https://docs.python.org/2.7/library/unittest.html

This drops unittest2 in favor of the standard unittest package.

Change-Id: Idb4cb10509f49afe86bfdb688e35a7822dfe38bd
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-12 02:40:41 -06:00
OpenStack Proposal Bot b33d398950 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I1023589516ff90b77b7a2a848ef943bd21ff4da7
2019-12-22 07:06:50 +00:00
Sam Morrison 9fe5a99acd Eventlet monkey patching should be as early as possible
We were seeing infinite recursion opening an ssl socket when running
various combinations of python3, eventlet, and urllib3. It is not
clear exactly what combination of versions are affected, but for
background there is an example of this issue documented here:

https://github.com/eventlet/eventlet/issues/371

(Commit message copied in part from nova commit
3c5e2b0e9fac985294a949852bb8c83d4ed77e04)

Change-Id: I76fed9e80a7f848a0f6b37c25dd035844c75a6ee
2019-12-18 16:08:53 +11:00
zhurong 0ce2ad12d0 Update semantic_version to 2.8.2 and remove multiattach in volume template
Change-Id: I7fedbcf85ee9c4dbacf1fc50cec25380c3b3e93d
2019-09-19 02:45:34 +00:00
zhurong 81acfe0f17 Add ip_version for NeutronNetwork subnet
Change-Id: I84791c93319dbd70fde436cc538b0e776e2a2a6d
2019-08-22 00:44:12 +00:00