Commit Graph

80 Commits

Author SHA1 Message Date
Brendan Shephard 5e14163f9c Allow multiple required_service_extension
In some cases, some resources may require more than
one service_extension. In this case, we should allow
resources to define a list of required resources.

Change-Id: Iee0104a741cc050047824d23b8ab5ee9871c4f28
2022-04-26 06:37:05 +00:00
Zane Bitter 5c6038f7a2 Check external resources after creation
The method Resource.check() is not a generator function, but it does
return a generator in most cases. Simply calling the function does not
cause the resource to actually be checked. Only in the case where the
resource did not provide a handle_check() method would it do anything at
all - and in that case it simply changes the state to CHECK_COMPLETE.

Yield the generator function so that the resource will actually be
checked if the resource type supports it.

Change-Id: I2a78b6f6235529a95838307e3d38731d31ff5c4b
Task: 37828
2020-04-30 09:51:40 -04:00
Krzysztof Opasiak ac75457cc9 Rename mox_resource_id to mock_resource_id
As we no longer use mox library it is misleading to keep
names starging with mox so let's rename this prefix
to mock_.

Change-Id: Ia376b9dcb7bf964df3c30f6757a6061c1850ee95
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2018-08-27 17:50:19 +02:00
huangtianhua 1861ad8867 Remove the existing snapshots from the backend
We only have to remove the existing snapshots
for resources when stack delete.

Change-Id: Ia195f3c3380fe71e0888c8291209dd4562318951
Closes-Bug: #1716612
2017-09-14 10:16:01 +08:00
Zane Bitter 165fb8ace4 Only check service availability during validation
There's no need to check it every time we create a Resource object.

Change-Id: I92082d64e6060c2d8d29d866fdabeea2846253e9
Closes-Bug: #1706197
2017-08-01 11:47:14 -04:00
Zane Bitter dc957bc2a6 Revert "Support attributes with dynamic scheme"
This code was never used for anything, as the rest of the patch series
never landed and was abandoned.

This reverts commit 15e52ff5e9.

Change-Id: I7d1a22753e8de1d3adf127c14516ebd667513bfa
2017-06-26 14:39:11 -04:00
rabi a8129573d2 Fix handle_restore for server and volume resources
When resource references are used for properties restore
does not work for nova server and volume resources.

This patch fixes it and adds a functional test for it.

Change-Id: I34efb3f4e0d3578d95134793f5c5d413667790e0
Closes-Bug: #1687009
2017-05-19 11:56:27 +05:30
Crag Wolfe a7376f7494 Consolidate resource locking with state changes
Change-Id: I261b2f0968e16d35b7d5d791a3edb4b265a4f1d1
Closes-Bug: #1662585
2017-04-25 08:21:42 -07:00
liyi 8f10215ffd 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: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
2017-03-25 17:11:50 +08:00
Zane Bitter 0951799e70 Unit tests: add a test resource that takes multiple steps
All of the current test resource types complete in a single step (i.e. have
no check_*_complete() methods). In order to test longer-running resources,
add a resource type in which the number of steps can be specified as a
property.

Change-Id: Ia894efa3207130a187032f2f667c096dee883aea
2016-07-18 16:26:17 -04:00
Zane Bitter 40036afff2 Add a Resource plugin API for cancelling actions
Allow a resource type plugin to provide a handle_*_cancel() method to
handle cancelling an in-progress action.

Change-Id: I20d243328daf1ffa1a40d55c5fcf889c70a8a59c
Related-Bug: #1585815
Related-Bug: #1591337
2016-07-13 17:03:56 -04:00
Oleksii Chuprykov fa33a1d4e3 Do not show HIDDEN props in res type show
Also do not display hidden attributes.

Closes-Bug: #1599093

Change-Id: I5fae1708c8140cd61436f80cdf595f05f4a2b2a4
2016-07-06 17:47:55 +03:00
huangtianhua beb86a2981 Correct parameter when raise NotSupported exception
"TypeError: __init__() takes exactly 1 argument (2 given)"
raised when show-schema/generate-template for a hidden
resource type.

Change-Id: I18089d9be2f7bc8780073eaa4e583262641fcc18
Closes-Bug: #1597647
2016-07-01 01:43:22 +00:00
Dmitriy Uvarenkov 558a8cd1e8 Correct message when extension is not available
Now if extension is not available, user gets
message 'Service endpoint not in service catalog'
which is incorrect. Patch corrects this behavior
and adds improved messages with more info.

Change-Id: I9b6c0d2921519590ef105be35e31db29cd1e3ecc
2016-06-27 11:09:32 +03:00
Thomas Herve 82f3817105 Use Zaqar signed URLs in software deployment
Instead of using a token that we need to create every time to poll the
Zaqar queue, create a signature and use it as an authentication
mechanism.

Change-Id: Ibf9f6c334eba024f6faa7d6bb708d6d9f778ee43
2016-06-21 10:01:49 +02:00
Steven Hardy 0b8d03a840 Re-add str_replace parameter validation, and fix test
This partially reverts https://review.openstack.org/#/c/275602/, which
removed the validation of the parameters argument completely, but a
comment added post-merge rightly points out that we can just check for
a map or function and still fix the bug.

Also, it seems that we had an existing test which failed to catch the
fact that this didn't work, so fix that to prove the expected
behavior works in the context of a stack, not just when resolving a
function snippet, and add a test which proves the reinstated
constructor validation works as expected.

Change-Id: I21c1868061e37760e1cb27f44ebb7c4ee97fefef
Partial-Bug: #1539737
2016-02-29 18:06:15 +00:00
Rakesh H S 5d070f9c59 Convergence: Fix FnGetAtt to fetch value from cache_data
Resource plugins will now override rsrc.get_attribute method to add
extra logic to Fn::GetAtt specific to resource implementation.

Also provides proper comment to rsrc.get_reference_id method.

Change-Id: I7561afa1c824b2294dd6701be6a19723abbe0522
Closes-Bug: #1531840
2016-01-20 09:27:14 +00:00
LiuNanke 208d2debd0 Using LOG.warning replace LOG.warn
*Python 3 deprecated the logger.warn method, see:
*https://docs.python.org/3/library/logging.html#logging.warning
*so we prefer to use warning to avoid DeprecationWarning.

Change-Id: I07ee9c97c3548c965aaf83d34b37b23e9baba584
2015-12-29 09:32:42 +00:00
Steven Hardy 3f9e58113b Conditionally check for service extensions
Currently we always check for service extensions, even when the endpoint
doesn't exist, which leads to a spurious backtrace in the logs.

Change-Id: I0b7b6c1ed4ce39602b3745408e059a0d7a453130
Closes-Bug: #1515215
2015-11-11 12:49:25 +00:00
Miguel Grinberg 939f0fddce Add signal_transport property to Heat wait conditions
This change enhances Heat wait condition resources with selectable
signal types. The token based signal is kept for compatibility, but now
the user can opt for any of the other signal types supported by the
SignalResponder class.

Change-Id: Iafc28954b743f0dc46a49d29d42e7123827930b8
Implements: blueprint uniform-resource-signals
2015-10-13 12:27:05 -07:00
Peter Razumovsky c4b0ced813 Fix [H405] pep rule in heat/tests
Implements bp docstring-improvements

Change-Id: I2fd82d698f42aca3b34822875cf4d706fedbf5f2
2015-10-12 14:08:16 +03:00
Steven Hardy 99ae1702ff Allow selectively disabling resource validation
For template-validate to use the normal stack.validate code instead
of reimplementing different validation logic, we need to disable
the resource plugin validate() methods, because in nearly all cases
these refer to resource property values, which don't exist at
template-validate time, where parameters aren't mandatory.

We do however want to ensure structural/syntax issues in the resource
definition are caught as early as possible, so add a stack
resource_validate attribute (defaulted to True) which enables selecting
only the resource.Resource superclass validate logic, so we can defer
the full value validation until create without maintaining completely
separate logic.

Change-Id: I501c8c36e923baa8d9b3f0395aaee41f7585ebb1
Partial-Bug: #1467573
2015-09-17 14:59:49 +01:00
Jenkins e6f375e8fc Merge "Work around parameter error deleting backup stack" 2015-09-15 08:17:01 +00:00
Steven Hardy fc77e43297 Work around parameter error deleting backup stack
There is a problem where restoring a backup resource which references
a parameter in it's properties that doesn't exist in the backup stack
will fail to delete, if the property is referenced in the delete path
of the resource.

We can work around the problem by always returning the frozen_definition
properties on delete, provided there are stored properties to refer to.

Closes-Bug: #1494260
Change-Id: I462ce7161497306483286b78416f9037ac80d6fa
2015-09-14 22:55:51 +01:00
Zane Bitter ab78bde75b Work around problems storing huge properties in events
There is a maximum limit on the size of the resource properties we can
store for an event in MySQL.

To work around this, store an error instead of the largest property,
as this is expected to cater for graceful-failure of the most common
known case (large SoftwareConfig config properties), with a fallback
of storing only the error when this also fails.

Co-Authored-By: Steven Hardy <shardy@redhat.com>
Co-Authored-By: Marios Andreou <marios@redhat.com>
Closes-Bug: #1493858
Change-Id: I668c7ed8ca6c063fd20bc5271d6afea941a5f277
2015-09-11 15:04:23 +01:00
Kanagaraj Manickam 7153d99f6c Search resource type based on version
Adds the filtering support to resource type based on
the type version match.

implements blueprint heat-resource-type-search

Change-Id: Iea626c762dfd6ad53e034ebaf7cdb6e3795694d0
2015-09-03 09:55:47 +05:30
Kanagaraj Manickam 719a043854 Validate support_status while searching resource registry
Validates the resource_type's support_status when it is
searched from global ResourceRegistry. This saves user from
searching for invalid support status.

implements blueprint heat-resource-type-search

Change-Id: I620ead91b024b369e4f2d8971f1190da61cfc0b2
2015-08-31 10:01:04 +05:30
Jenkins 8caccf0470 Merge "Don't raise exception when get nested stack" 2015-08-20 15:36:59 +00:00
Wang Muyu b070ed0286 Improve unit tests to succeed without hash tweak
PYTHONHASHSEED was set to 0 to disable hash randomization, because some
tests assertions were order sensitive. This commit is to improve the
assertions, so the PYTHONHASHSEED hack in tox.ini is not needed.

Change-Id: I4ff09d202af818d27321e8e83718e82d0c48e3d2
Closes-Bug: 1348818
2015-08-19 10:52:08 -04:00
Jenkins 044a970bd8 Merge "Support attributes with dynamic scheme" 2015-08-11 15:18:55 +00:00
Angus Salkeld 15e52ff5e9 Support attributes with dynamic scheme
Some resources (software deployment, template resources, etc)
doesn't have static attribute scheme. So when we are trying
to output attributes for such resources the output always
returns None or null. So the patch support this functionality
with the new type of attributes: dynamic scheme attributes.
They allow to resolve dynamic attributes for resource outputs
and fetch such info as nested stack attrs or
software deployment outputs.
The next patch will enable usage of dynamic scheme attributes
for heat resource.

Change-Id: I474addad0bbfe16aa5c562f2d6025c52f175dd4f
Partial-Bug: #1470675
2015-08-10 12:17:01 +03:00
huangtianhua b101190f32 Don't raise exception when get nested stack
1. Stack.load() won't return None, instead will raise
notFound exception if we can't get the stack from db.
So we should catch the notFound exception in
StackResource.nested() when loading.
2. Return None if we catch the notFound when get the
nested, due there are many places where we call the
nested(), and raise the notFound exception makes no sense.

Closes-Bug: #1479579
Change-Id: I2540ca13572dfe628e6fc596815bee427b41290f
2015-08-07 14:26:07 +08:00
Jenkins 8ef708b8d0 Merge "Use base attributes with attribute_schema of class" 2015-08-04 13:47:43 +00:00
Sergey Kraynev f419c6405e Use base attributes with attribute_schema of class
attribute_schema of Resource class sometimes used directly without
creating instance. It allowed to situation, when attribute_schema is not
updated by base attribute.

This patch adds base_attributes_schema dictionary for these cases.

Also added same approach for resource_facade and updated tests.

Closes-Bug: #1481020

Change-Id: I104dae2fa3f3394195c1fd9bbed1902a9e4ba31f
2015-08-04 09:24:53 +00:00
Sergey Kraynev 02275f8901 Add base resolve method for attributes
Current patch adds two new methods to base class:
 * _resolve_all_attributes - for choosing path for resolving, which
   depends on type of attribute (base or custom).
 * _show_resource - method for resolving base 'show' attribute.
 This method should be re-defined for resources, which use clients with
 specific implementations of 'show' commands.

 New attribute for base class was added - entity, which is used for
 resolving 'show' attribute.

 Tests for Neutron resources and Server resource were updated
 corresponding changes mentioned above.

 Hook for stack_resource class is removed in this patch.

Change-Id: I4ee0a53407739e5590c9a8d12bc7c1e84077f4c4
2015-08-03 08:19:11 -04:00
Jenkins d79d576ff6 Merge "Support to view all attributes of resource" 2015-07-29 04:20:57 +00:00
huangtianhua b9952540ed Support to view all attributes of resource
Support to view all attributes including items in
attributes_shema and in details dict returned by
the API.

Change-Id: Id725299bcb6c17508279e27efef3c3df5d272acc
Closes-Bug: #1472159
2015-07-28 18:41:17 +08:00
Sergey Kraynev c1069f6c63 Move internal test resources to generic_resource
Move follow resources from the tests to common generic_resource module:
- ResourceWithFnGetAttType
- ResourceWithFnGetRefIdType
- StackResourceType
- ResourceWithListProp
- ResourceWithRestoreType

Change-Id: Ifa07b278469e115f6a475b571e5349df98629787
2015-07-24 09:30:06 -04:00
Jenkins 8fe749e8a0 Merge "Move signals to SignalResponder class" 2015-07-15 05:23:28 +00:00
Miguel Grinberg ca8effbbae Move signals to SignalResponder class
This change relocates the code that creates and deletes heat, swift and
zaqar signals out of SoftwareDeployment and into SignalResponder, as a
first step in making these signals available to all resources. As part of
this change the structure of the Swift URLs was changed to match that of
the SwiftSignal resource.

Change-Id: Id5701b3696b0ab41433a3f158fabce1f36aabe16
Implements: blueprint uniform-resource-signals
2015-07-14 10:41:30 -07:00
Kanagaraj Manickam 490c36f7d0 Conditionally expose resources based on available services
If the required keystone service for a given resource does
not exist in the keystone catalog, raises
StackResourceUnavailable.

It will be effective only if default_client_name is defined
in the given resource.

It also fixes other test cases, where is_service_available
needs to be returning True

implements blueprint keystone-based-resource-availability
Closes-bug: #1388047

Change-Id: I92afa9ffc3a3333b46dc25921cf7f982777cba76
2015-07-07 14:25:44 +05:30
Miguel Grinberg 0679458a59 Prepare SignalResponder class for more signal types
This change makes some minor refactorings in the SignalResponder class
to disambiguate the existing signal support and allow for the addition
of other signal types currently supported elsewhere in the codebase.

Implements: partial blueprint uniform-resource-signals
Change-Id: I353558431a8851e4e43c8a787f03190ed508bb5d
2015-06-30 11:36:14 -07:00
tyagi cafd53be11 Add type field to the resource attributes schema
Add data type for the attributes. This will help
1) validating the attibute against its type
2) resource-schema api will show the attribute type
3) template authors will know what type of value to
   expect making indexing and mapping easier
4) generating docs for the attribute type

Implements: blueprint add-type-in-attributes-schema
Change-Id: Ifc92c57ec1ddd2ab5f810587a1d33e762308dd8a
2015-05-06 00:50:47 -07:00
Peter Razumovsky 83f0ae1590 Move generic resources to properties schema
Not all resources in generic_resources file on
properties schema. Use properties.Schema instead of
dictionary.

Change-Id: I558b33c304f38a5819b7b54c780181430ee7b1be
2015-03-30 12:14:21 +03:00
Peter Razumovsky 664f70383b Add extra check for signal during DELETE or SUSPEND
All resources, which have handle_signal, check condition
if action in DELETE or SUSPEND state. Move this check to
Resource class.

Change-Id: Ifa9e97c19cc35c4b2aa40dbed37296d9d4a38d5b
2015-03-25 18:47:23 +03:00
huangtianhua a1336e2527 Move resource inheritance class to engine/resources
Move the resources which inherit from 'Resource'
to engine/resources, such as stack_resource,
stack_user and signal_responder, and move
non-resources to engine/, such as iso_8601.py module.

Change-Id: Ic26c34cc8d34ca03ce674dc8c6ac32c10885b75f
Implements: blueprint reorganize-resources-code-structure
2015-03-10 18:07:46 +08:00
Steven Hardy 70112c103a Move logging to use oslo_log library
The oslo-incubator log modlule has been removed, so port to the oslo_log
library.  Note this uses the new (non namespaced, e.g oslo.log) import
convention, we'll need to align other imports in a future commit.

Some import reordering was required due to pedantic H30[57] checks, and
the services have all been converted to initialize the oslo_log library
as this is done differently to the log.py in incubator.

Change-Id: Ib5a97123fe1b287bc531e42d7887c13ba6205628
2015-02-17 09:23:34 +00:00
Pavlo Shchelokovskyy cb8712281d Enable H904 style checking rule
Use parentheses instead of backslash for line continuation.

Plus, usage of escaped quotes in long strings is avoided where it makes
sense.

Change-Id: If2e78012b85a4430c6f03f65784cac2d032cf116
2015-01-20 11:14:06 +02:00
Peter Razumovsky 715010f40a Convert unicode to six.text_type in heat/tests
This patch converts unicode to six.text_type in heat/tests
for python 3.x compatibility.

Change-Id: I2e7553ee3486e03c6a9bc0c2a022f99d6298257b
2014-12-08 16:47:19 +03:00
Angus Salkeld d32370233e Make sure that the properties are stored on updates
Previously properties_data was only stored on creation, now
this is getting passed to the update mechanism too.
Later we can look at reworking this into a single mechanism.

Closes-bug: #1377681
Change-Id: If3d476f34b9e61a3c99f63ba33734a875353c8fc
2014-10-10 12:04:18 +10:00