Commit Graph

10 Commits

Author SHA1 Message Date
Ronald Bradford 9b19e4a0f4 Refactor existing context attributes to base class
The oslo.context base class already supports is_admin and roles
attributes. This patch removes unnecessary overrides. It also fixes
inconsistency in tests, where some of the parameters, passed to the
dummy_context were not passed to the resulting RequestContext.

Co-Authored-By: Kirill Zaitsev <k.zaitsev@me.com>
Change-Id: Idf979528b9d9df3305ba1994009367061fd4f413
2017-05-10 15:58:00 +03:00
Alexander Tivelkov 2858689767 'GetPackageUI' API can now be called even if Glare is used
Since Glare support was introduced the 'catalog/packages' part of
Murano API (/v1/catalog/packages) became obsolete and was intended to
be used for "legacy" (i.e. non-glare-based) package storage. The
murano client was supposed to directly call glare to retrieve the
packages.

However, the "GetPackageUI" call (GET
/v1/catalog/packages/%pkg_id%/ui) is different: not all the packages
bundle the UI definitions, some require Murano to generate them based
on the contents of the package. This is true for HOT-based packages
and others, plugin-based ones. In future this will be true for 100% of
the packages when the dynamic ui and object model generation is added.

Because of this that API should be callable even if Glare is
configured as a package storage backend. It should fetch the artifact
from glare, unpack it and use whatever plugin-specific logic required
to generate the UI definitions for this particular package.

This patch introduces appropriate change while maintaining the
backwards compatibility: in the legacy mode (i.e. when murano's DB
acts as package storage) the UI is read directly from an appropriate
DB table without fetching the whole package.

This fixes the issue when the HOT-based packages could not be
deplpoyed properly with murano-dashboard, but the murano-client has to
be updated as well to properly call the modified API even if Glare is
enabled.

Change-Id: Id9327e4015e1c0a1553c0b1a0151a94ee4da2928
Partial-bug: #1565805
2016-04-08 15:27:10 +00:00
Ronald Bradford 6136b8d3a5 Define context.roles with base class
In Ia575ba803a0fb70f39146bd75d381ed19414bd23, oslo.context (2.2.0)
added roles support in the context itself. This passes roles to
super()__init__ and uses the default to_dict().

Depends-On: I79ea029ceb67173e69631b4e6e614fa62e159227
Change-Id: I1807f19aa867f17c055bb018b6cce6f569f90ca4
2016-04-04 14:46:40 +00:00
Kirill Zaitsev 53845d84e7 Add roles to RequestContext.to_dict if they're not there
Old versions of oslo_context do not include rules in to_dict()
However roles are required for newer versions of oslo_policy to operate
and resolve 'role:xxx' rules.

Since minimal version for oslo_context is 0.2.0 and commit, that adds
roles has been added only in 2.2.0 we should support old versions of
oslo_context with newer version.

Change-Id: If35726613bec5d342bad72b542215ec8e5c096a2
Closes-Bug: #1552291
2016-03-03 02:18:54 +03:00
Ravi Shekhar Jethani 7ea4442e9c Fix import order of modules
Make corrections in import order for six, yaml, eventlet and
greenlet as per OpenStack import standards [1].

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

Change-Id: I26feb4adb81e8b07a7a36ac7f0a6235536a8c119
2016-01-24 23:34:03 -08:00
Kirill Zaitsev b64b9d72ee Inherit RequestContext from oslo_context's RequestContext
Before murano used RequestContext, inherited from object.
oslo_context has graduated and includes a bunch of features, that is
used by oslo_log and other oslo modules.
In particular this commit enables logging of request_id, user_id and
tenant_id in all context-aware requests.
Alters tests tto make them pass regardless of the new context.

Targets blueprint: murano-x-openstack-request-id-support

Change-Id: Ic22f67ae89881581254de8787fa3632dfa1af08f
2015-08-13 15:12:59 +03:00
Ekaterina Chernova d82b74b62f Update API policy
* Set admin rule for a several API calls and remove direct check in code
* Now admin can configure policy.json and enable package management for regular users
* Update common policy module

Closes-Bug: #1412868

Change-Id: I8d0725b613564529d32a5acef289f4822f32915c
2015-03-02 15:28:14 +03:00
Ekaterina Fedorova d6a3a2b2e6 Enable H202, H402, H404 rules
* H202 assertRaises Exception too broad
* H402 one line docstring needs punctuation
* H404 multi line docstring should start without a leading new line

Change-Id: I2f662b8b97d14daa501620c8237bf93bd2251243
2014-09-01 09:10:51 +00:00
Steve McLellan 185dd9305a Add policy checks to API
Adds ability for deploy-time auth checks to allow/disallow
functionality, in line with other openstack projects.

Includes update of code in openstack/common, which is why the
patchset is so large. oslo-incubator changeset is May 27th
caed79d8239679cb74476bb0d9e5011b4fcc39da.

Implements blueprint policy-checks-in-api

Change-Id: I67a431dcc74f0a77ed48b7a489136d5008773cea
2014-06-11 13:37:41 -05:00
Ruslan Kamaldinov 86a4c4710d Rename muranoapi to murano
Partially-implements blueprint: rename-murano-api-to-murano

Change-Id: I2d7f52ef4073bce800cedc77f81f5d242c4d5d98
2014-05-27 15:14:44 +04:00