Commit Graph

197 Commits

Author SHA1 Message Date
zhurong 68d653af0a Fix bandit
Change-Id: I664a6c22b6b68cd2ea0ffcae1b8242fa7d61f14e
2023-04-25 02:46:44 +00: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 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
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
zhurong 8bf959f805 Remove six murano/api
Change-Id: I53368580d7a2d1923688be80899c97c57aafffad
2020-04-18 08:38:48 +00:00
zhurong 4ee97f7b7a Bump to hacking 1.1.0
Change-Id: I4019f41d9ddd843872855e6e80c0667ee2df758a
2019-07-04 11:51:47 +00:00
Zuul 543b7cb3ea Merge "Correct the environment template clone error message" 2019-05-05 01:32:36 +00:00
chenaidong1 2ea5234a4d Correct the environment template clone error message
When cloning environment template with the same name, the
current exception description is "Environment with specified name
already exists", "Environment" in the exception description
should be "Env template".

Co-Authored-By: zhurong <aaronzhu1121@gmail.com>
Change-Id: Iaf5868c173963eb737e27c2a3221f6b6a23fac84
2019-04-30 07:42:54 +00:00
zhurong e5c89bb4a7 Merge the user given tags when update package
Change-Id: I1b4a556f619c346da49c0ddf5085b2aa12e7752e
2019-03-11 17:02:31 +08:00
zhurong e6dc1f0819 python3 ValueError object has no attribute message
Change-Id: I09862b245774ab4b26f2ea11dfe4d0cc1d4305b7
2018-12-28 13:06:42 +08:00
Zuul ca4f75cae0 Merge "Log message" 2017-10-18 06:38:15 +00:00
chenaidong1 090e2d2f9f Log message
From the following code, session can't be opened when environment
status is DEPLOYING or DELETING status.

if env_status in (states.EnvironmentStatus.DEPLOYING,
                          states.EnvironmentStatus.DELETING):

Change-Id: I4f20b51f87a77cfbf2d76e9961d8bfaa6380aac8
2017-10-12 17:31:46 +08:00
chenaidong1 19fcdae863 Format string sequence error
'body' is the first parameter, and 'env_template_id' is the
second parameter.

Change-Id: Ifc449cf1b52147f12de11c898b22075174a793bf
2017-10-12 16:06:16 +08:00
chenaidong1 12f6d0c0b3 Code optimization
The following codes have been excuted in function '_validate_exists',
and the result has been returned. therefore it is not necessary to
excute the following code again.

get_env_template = env_temps.EnvTemplateServices.get_env_template
env_template = get_env_template(env_template_id)

Change-Id: I2aeb835b1cda1b30f4fffbbd293beb42efc78588
2017-09-16 04:14:38 +00:00
Margarita Shakhova 3877f610ef Implement environment audit reports
Add notifications about environment events that are required for
tracking. These are AMQP notifications and oslo.messaging library
is used for sending them.

The follow event types are provided:

 - environment.deploy.end
   This event is issued on successful finish of environment deployment,
   provides general information about environment and also deployment
   start and finish times

 - environment.delete.end
   This event is issued on environment delete (and abandon as well)

 - environment.exists
   This is a period event, it's issued for every existing environment
   that has successful deployments

There are 2 new configuration options controlling these notifications:

 - stats.env_audit_period
   Controls how often to send environment.exists notification, by
   it's once per hour (60 minutes)

 - env_audit_enabled
   Allows to completely disable environment-related notifications. By
   default notifications are enabled.

Change-Id: I8dee2456b7ccab7c0c167aa21abb9710959ebb30
2017-08-24 10:11:35 +00:00
Gyorgy Szombathelyi 78abdaa130 Use consistent session options
Various components defines different options for the client sessions.
Standardize them with the help of keystonauth1 lib.

Change-Id: I2f791caaf230a58b8426d1c1d6e1eb4316a85a28
2017-07-28 14:55:45 +02:00
Felipe Monteiro fb3c5625df Remove long-ago deprecated show_categories
The API catalog endpoint `show_categories` was deprecated back
in Liberty cycle. It should be removed.

This commit removes the deprecated endpoint `show_categories`,
removes it from the API router, and removes references to it
in Tempest tests -- which now test `list_categories` instead.

Change-Id: If1bea7448c0d4aa5fdf37c8400323589d73fdb21
2017-06-22 15:58:25 +01:00
Paul Bourke 02d7a9cf39 Remove dead code
These functions are not used anywhere.

Change-Id: I6428cb056e59d1510e80e9dd463d1d133b32529c
2017-06-01 16:49:44 +01:00
Jenkins 1fd33aa37a Merge "Updated murano-apste.ini with http_proxy_to_wsgi" 2017-05-26 11:41:08 +00:00
shashi.kant 02ec8d03ed Updated murano-apste.ini with http_proxy_to_wsgi
Murano used to have a custom, always-enabled ssl middleware, to parse
X-Forwarded-Proto header, to let murano work correctly behind an SSL
proxy. There is now an oslo middleware, that does the
same thing, but more thoroughly.
This commit replaces custom implementation with oslo one.

Co-Authored-By: Kirill Zaitsev <k.zaitsev@me.com>
Change-Id: I5444542b878434fb656e19b12d0f6e71df1ab95f
2017-05-25 15:01:40 +03:00
Jenkins 8306d84093 Merge "Update rename environment API endpoint" 2017-05-12 17:51:01 +00:00
Felipe Monteiro 55915d3a84 Update rename environment API endpoint
The ``update`` method in the environments API is only responsible
for renaming the environment.

However, the entire request body is passed to the ``update``
DB method if the name of the environment meets the initial checks
(enough characters and not empty string).

While this is not a problem if the request body is generated
through the CLI client or the dashboard, it is a problem using
something like curl, in which other attributes in the environment
could be added to the request body, causing the environments API
to violate its contract: an endpoint that is supposed to rename
an environment should only ever rename the environment.

Change-Id: If6314f704c22ff4d61411b1808d6d73bfb7ac562
2017-05-04 16:21:39 +00:00
M V P Nitesh 580677eedc 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: I45fa65427318e1c35bb521de46e81ea12ca7b770
2017-05-03 09:17:18 +00:00
shihanzhang 06746baa32 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: I24ca32d9e92cdd2b3a91916337839d116e335084
2017-04-03 12:11:20 +08:00
Felipe Monteiro c30c27fb0c Allows fetching of deployments from all environments.
Adds new endpoint /deployments to Murano, to enable
Murano Dashboard to get all deployments for all environments.
This is needed in order to improve log browsing for
deployments, which calls for creating a new view in which
all deployments across all environments can be viewed.

Also made deployment unit tests more robust.

Partially-implements: blueprint improve-deployment-log-browsing
Change-Id: I1b6a313af1a0c4aa57bd4e6f51da92b396b35165
2017-01-16 12:00:33 -05:00
chenaidong1 cfb99dd9db modify print information
From the following sentence,the environment status has DEPLOYING or
DELETING status,but the environment status of log information only
include deploying status.

 if env_status in (states.EnvironmentStatus.DEPLOYING,
                          states.EnvironmentStatus.DELETING):


Change-Id: Id48e69dec671ef31b87ec803667e69f9b906b17f
2016-12-07 08:36:08 +00:00
Alexander Tivelkov 81eebd12ad Ability to retrieve current/owner user/project
Added an ability to retrieve information about the current user,
current project, environment owner (both user and project)
from keystone. Appropriate information (including
extra fields but excluding internal system data) is fetched from
Keystone using the same service credentials that are used to validate
tokens, create trusts etc.

- io.murano.User and io.murano.Project classes were added.
- Both classes have 2 static methods to get current and environment
   owner object of appropriate class
- Object model now contains project_id/user_id of the user who
   created the environment
- Deployment task contains project_id (renamed from tenant_id)
   and user_id of the user who initiated the deployment

Change-Id: Ic7e24c1d2b669ed315851047bcdb27e075cfc56b
2016-11-24 02:07:34 -08:00
Jenkins fc32a8b620 Merge "Filter enviroment list by project id" 2016-11-07 22:52:22 +00:00
Jenkins 3ef1d83c91 Merge "Fix debug output for SSLMiddleware X-Forwarded-Proto" 2016-11-02 18:47:44 +00:00
Artem Tiumentcev 1c14cc322e Fix debug output for SSLMiddleware X-Forwarded-Proto
Before this patch debug output was excessive.
Now print the line log if wsgi.url_scheme differ and

Change-Id: I925a7dd0844dfa76696b75e9f818d1bb47b34928
Closes-Bug: #1605806
2016-10-22 11:10:11 +03:00
Valerii Kovalchuk b3a06349c5 Add environment edit API
'/environments/<env_id>/model/<path>' endpoint added.
GET request responds with the subsection of <env_id>'s object
model located in its <path>.
PATCH request applies json-patch from request body to <end_id>'s
model. It does not contain <path> in the URL.

Change-Id: I672d43464ed7d5722cc574f1a10700b070664f34
Implements: bp environment-edit
2016-10-06 12:48:57 +00:00
Alexander Tivelkov 8e7cb32077 Filter enviroment list by project id
Modified a "List Environments" API call to add an ability to filter
environments by an owner project (tenant).
The request now supports extra query parameter - tenant. If this
parameter is passed the list of returned environments is filtered to
return only the environments owned by the tenant with this id.
This operation requires a 'list_environments_all_tenants' policy to be
enabled for a caller user (by default it means that the user has to
have an "admin" role).

Implements-blueprint: list-environments-of-a-given-project
ApiImpact

Change-Id: I90b0dd672d5a431f63e52753d7f517fd3d0ec6eb
2016-10-05 14:30:25 +00:00
Valerii Kovalchuk 945cc04806 Allow to PUT an empty object model
It was impossible to delete the last component from the env via
CLI, because it was prohibited to make put request with empty body.

APIImpact
Change-Id: I462072ad7c90eec1790b74cae958809aa316c25c
Closes-bug: #1511645
2016-10-03 18:28:53 +00:00
venkatamahesh 403bb2721a Fix the python3.4 TypeError
Python3.4 throwing TypeError and in this patch it
is fixed

Co-Authored-By: David Purcell <david.purcell@att.com>
Change-Id: I5cbc54142ba2fd1885879c2e401ba84095becc1a
Closes-Bug: #1625219
2016-09-29 11:08:50 +00:00
Cao Xuan Hoang 688dcd0f88 TrivialFix: Remove cfg import unused
This patch removes cfg import unused in
murano/api/middleware/version_negotiation.py
murano/api/versions.py
murano/db/catalog/api.py
murano/engine/system/test_fixture.py
murano/policy/model_policy_enforcer.py
murano/tests/unit/cmd/test_api_workers.py
murano/tests/unit/cmd/test_engine_workers.py

Change-Id: I0f12f15e4def84550ef5bde0840006211cac7809
2016-08-29 09:35:14 +07:00
zhangyanxian 50744ca68e Fix some typos in wsgi.py & catalog.py
Change-Id: I18f74b726caa208585f193b90824824aa3bbd272
2016-08-25 06:16:13 +00:00
Nguyen Hung Phuong 79a6914961 Clean imports in code
In some part in the code we import objects.
In the Openstack style guidelines they recommend to import only modules.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I80c70abd2f6973e1285eb7af2871d40d0a276712
2016-08-23 15:17:27 +00:00
Stan Lagun e0e3b10b8d MuranoPL forms implementation
Generation of json-schema from MuranoPL class or method
and engine RPC call for it were added

Implements: blueprint muranopl-forms
Change-Id: I43ccd2d9d94f9f89db1855932280539f69f2f8d8
2016-07-29 06:48:19 -07:00
Jenkins 302aae1cb6 Merge "Add filter based on 'in' operator" 2016-07-15 09:22:31 +00:00
Jenkins 0ec885a972 Merge "Implement API call and RPC call for static actions" 2016-07-12 14:51:48 +00:00
Gyorgy Szombathelyi 3d20f25d3b Use keystoneauth1 lib for authentication helpers
If auth_type is set in the keystone_authtoken section,
then one can use the the keystoneauth1 library to load the
authentication plugin. This makes muranoclient fully workable,
with Keystone v3 in case domain name is not 'Default'.

Related-Bug: 1580611

Change-Id: I0d71032fb5296752ee25482b75993072884731e7
2016-07-08 12:46:17 +00:00
Valerii Kovalchuk 7d186c191d Implement API call and RPC call for static actions
Static public methods can be called synchronously through the
API call without creating environment, object instances and
database records. It is proposed to make RPC call as the single
request-responce for now.
However async API and RPC calls may also be implemented later
exploiting the same pattern as for calling instance methods.
New call can be done through client method (see
Ib6a60f8e33c5d3593a55db9f758e94e27f0a4445)
Tempest and unit tests are added.

APIImpact
Implements: blueprint static-actions
Change-Id: I17ab2eba0fd6c42309667f42d0644d21940ab02d
2016-07-07 17:21:59 +00:00
Omar Shykhkerimov bbe19e434a Add filter based on 'in' operator
This patch makes possible to filter operator values 'id', 'category' and 'tag'
by provided comma-separated values whithin 'in' operator.

F.E. with filter '/a/b?id=in:buzz,bar' 'id' must be among
'buzz' and 'bar' values.

Related-bug: #1559066

Change-Id: Ibd93233392552699f9fc02e7f1d92542de2597f1
2016-07-06 22:01:05 +00:00
Jenkins df761a16f3 Merge "Fix application template update" 2016-06-28 08:58:04 +00:00
Jenkins b379753d0b Merge "Refactor API params tuples to sets" 2016-06-24 14:50:14 +00:00
Omar Shykhkerimov 5b8ab82b20 Refactor API params tuples to sets
SUPPORTED_PARAMS, LIST_PARAMS and ORDER_VALUES are used only to check
whether some value is inside of them.

This patchset makes them sets instead of tuples.

Change-Id: I0abfc555d1a481b20dc971c3a801fdf7e88aed2f
2016-06-23 13:31:43 +03:00
visitor 6e35fb4b57 Fix application template update
Updating an application/service in a environment template
does not work and return 404 error.  This patchs solves that
bug.

Change-Id: I03f51c45512c4282ef99ddc1ed9ba55460827a94
Closes-Bug: #1587833
2016-06-21 09:42:28 +02:00
Victor Stinner bcd838a38d Port API v1 unit tests to Python 3
* Replace len(MultiDict.keys()) with len(MultiDict). On Python 3,
  MultiDict.keys() now returns a generator which has no length.
* Replace json with jsonutils to fix Unicode vs bytes issues.
* Use a bytes strings for the HTTP body, not Unicode strings.
* Replace LOG.exception() with LOG.error() when the argument is a
  string, not an exception object.
* Only declare PackageException.__str__() on Python 2. The default
  implementation of __str__() is fine on Python 3. Moreover, the
  'message' attribute has been removed from Exception on Python 3.
* tox.ini: run the following API v1 unit tests on Python 3.4

  - test_actions
  - test_catalog
  - test_env_templates
  - test_environments
  - test_sessions

Blueprint: murano-python-3-support
Change-Id: I4c8bedef019495477ae668769595ac4abc1ac0f4
2016-06-20 12:29:06 +02:00
Jenkins 65e2ec60c2 Merge "Fixing application template deletion" 2016-06-08 22:41:59 +00:00
visitor 1adc59cef3 Fixing application template deletion
Deleting an application/service in a environment template
does not work and murano got blocked. This patch solves that
bug.

Closes-Bug: #1587809
Change-Id: I871e3b0eca82c14354b9c7ff2abce90da7cb21b0
2016-06-08 08:18:55 +02:00