This unifies the 'lightweight stack' used in convergence with the how
things work the rest of the time: we now always obtain resource data from
the StackDefinition's ResourceProxy objects. This means that when we are
checking an individual resource, we will never create all of the other
Resource objects for the stack in memory (although we already avoided
loading data for them from the database) - now we will only create
ResourceProxy objects as needed.
Change-Id: Id7472557e26d172df88841ff7f20afdd7f5bfada
Implements: blueprint stack-definition
Update the resource data in the StackDefinition in unit tests where
required to simulate how the real code works, e.g. after creating or
updating a resource.
Change-Id: Ie4aad264b8a776a323dcfd1843357c5a7eac094e
Formalise the format for the output data from a node in the convergence
graph (i.e. resource reference ID, attributes, &c.) by creating an object
with an API rather than ad-hoc dicts.
Change-Id: I7a705b41046bfbf81777e233e56aba24f3166510
Partially-Implements: blueprint stack-definition
setUp and tearDown will be automatically called around each
testcase, so this is to remove setUp and tearDown that doing
nothing additional than super to keep code clean.
Change-Id: I8b6943602419d3f360991721d90b61888b55ea60
There should always be a context supplied, lets use its session
directly so we can be sure that the session is the shared one from the
context.
Any remaining functions which call get_session() directly will be
handled in their own changes as some require special behaviour.
Change-Id: I3e52d2ff6bb1014f201715a1b1ba32c122c2391d
Related-Bug: #1479723
Extend the time override used when testing timeouts for wait conditions,
so that real time isn't used for waiting for the failure.
Change-Id: Ib1042fc748ecc490d315ec5a5844ceacc50534e0
Partial-Bug: #1524047
Fix FnGetRefId of WaitConditionHandle, ElasticIp and NeutronResource
to fetch value from cache_data, if present.
Change-Id: Icd92f6514c7590c90da2fcd2123d33862d613486
There seems no need to overwrite some methods for wait
condition handle resources, due the implementations are
same as super class.
Change-Id: I8acd4fd54c9ac8fb8fbcd149127d64ad0ff85818
This produces a nested exception like:
'ValueError: resources.nested.resources.my_server: it is broken, sorry'
This re-uses the path mechanism that StackValidationFailed exception
uses.
Change-Id: Id5204c15ee96784e04522ab3c5a8e66900f9a1d3
Closes-bug: 1459837
This will allow Resources to hold weak references to Stacks (so as to avoid
circular references) without causing the Stack object to be prematurely
deleted.
Change-Id: Ia76da7bc51042fb3598ef2a660d6fbf78137a37b
Related-Bug: #1454873
Classes in parser.py are already split to stack.py and
template.py, it's not recommended to import it.
Closes-Bug: #1442011
Change-Id: Ia8cc0ca07e7926fe8b7d9f5c89b39053a799e689
When we moved parameters from the stack table to the template table
we did it in a "flexible" way, but this led to some difficult to
diagnose problems. So this patch totally removes "env" as an argument
to the Stack class to make absolutely sure that we are doing this
correctly. I came across these bugs when rebasing decouple-nested.
- env was not getting passed into instance group make_templates()
- template deepcopy was not working correctly (causing some problems
when deleting backup stacks)
Change-Id: I85cfb01c68ff5a44e2ff4f6e446870efb7205933
Since split between AWS and OS WaitConidtion/Volume resources unit tests
for those resources were not running as they were not discovered.
During this time some changes were merged that actually broke some
tests (mostly the mocking) so this patch fixes those broken tests too.
Some AWS WaitConidtion tests were testing the handle_update method,
which has no sense now as it no longer returns a TaskRunner instance.
These tests were modified to use the general resource.update method.
One test in AWS volumes is modified to use mocked ServerConstraint,
which is added to base TestCase as are stubs for other constraints.
Another test in AWS volumes was using a dumb monkey-patching
instead of proper mock, leading to clashes during concurrent test runs.
Change-Id: Ie765eab75de835d5dec94024f1d90197f1723b4d
Closes-Bug: #1414083
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
Move the OS waitconditions tests to
heat/tests/openstack/test_waitcondition.py
and move the AWS waitconditions tests to
heat/tests/aws/test_waitcondition.py.
Change-Id: I1f065b1e219207a69b9c721703221945c93d69ac
Implements: blueprint decouple-aws-os-resources
It is a convention to have assertEqual() assertions invoked with
'expected value' before 'actual value', or else the debug output may
become very confusing. This patch fixes about 100 violations in current
test cases where about 3580 assertEqual calls are made.
Closes-Bug: 1259292
Change-Id: I2e0474d9821716baf35a3bbb2952c63a84749dd3
Fix the HeatTestCase import issue as required by H302,
a following patch of https://review.openstack.org/#/c/129846/
Change-Id: Iab9a508682e9fe2932b7d00b191c8a4cdea4738b
Return data describing the status and reason for the signal when
handling a signal for a WaitConditionHandle resource. This enables
an informative reason to be included in the event associated with
the signal created in resource.Resource.signal, currently it is
always "Unknown"
Change-Id: If504fd49a479f783e034ff908ecdf785faaac265
Partial-Bug: #1340894
Move to a common curl_cli attribute, which can be used for both
success (default) and failure (by passing appropriate status data,
and optionally reason). This should allow a slightly more flexible
interface than the current success/failure attributes, while still
remaining simple, and enabling simpler portability between this and
the alternative Swift signal implementation.
Note this breaks compatibility with the attributes we just recently
merged, but I'm assuming since it's so recent nobody is using it yet.
The example template at https://review.openstack.org/#/c/106424/ has
been updated to reflect the new interface.
Change-Id: Iac09aaa60ef5c1de27c9eeca7c65eca41c06907e
blueprint: native-waitcondition
When switching to oslo.i18n, tests where used str(exc) will failed
with unicodeerror, so before switching to oslo.i18n, need to
replace str with six.text_type where exception is used. And it's
recommanded to use six.text_type instead of str in openstack.
Change-Id: Ie37a6ef74a12b2580ce72afc75c99bcd19d4cf97
Adds a native OS::HeatWaitConditionHandle resource, which works
in a similar way to the CFN compatible one, but with a few changes
to make it simpler to use:
- The data passed is validated less strictly, so we tolerate missing keys
for any of the data (we just fill in default values)
- A signal passed with no data is assumed to mean success
- There are two convenience attributes which provide a string representing
the necessary curl call to send the signal (to the native ReST API)
This allows a similarly simple signalling mechanism to the CFN compatible
Handle resource, but with no dependency on the ec2tokens keystone extension
or heat-api-cfn service.
Some usage examples here:
- https://review.openstack.org/106424
blueprint: native-waitcondition
Change-Id: Ie9b5aeb13bfab5fba55c1a49d1572e0777864b29
The metadata_update interface does pretty much the exact same thing
as handle_signal, with the disadvantage that it's not exposed via
the native ReST API, so convert WaitConditionHandle to use
handle_signal.
This has the following advantages:
- Provides a step towards native waitcondition resources
- Enables signalling existing waitcondition resources via
heat resource-signal (e.g the native API)
- Moves towards a standardized model where handle_signal is the
only supported plugin interface for asynchronous signalling of
resources.
To avoid breaking any CD folks who may not update heat-engine and
heat-api-cfn at the same time, the existing resource interface is
maintained with a deprecation warning (how long to maintain this
is TBC).
Change-Id: Id7dde1c5f13683950a1cb483ae2ce4d1fbf2a56e
blueprint: native-waitcondition
This reverts commit a60f2722f8.
This and/or the next commit (f2f2697c9d)
are causing Metadata to return blank after signals are processed.
Change-Id: Ic4e068fd1e26e51e826055cebed6a392a5595bf9
Partial-Bug: #1337772
The metadata_update interface does pretty much the exact same thing
as handle_signal, with the disadvantage that it's not exposed via
the native ReST API, so convert WaitConditionHandle to use
handle_signal.
This has the following advantages:
- Provides a step towards native waitcondition resources
- Enables signalling existing waitcondition resources via
heat resource-signal (e.g the native API)
- Moves towards a standardized model where handle_signal is the
only supported plugin interface for asynchronous signalling of
resources.
To avoid breaking any CD folks who may not update heat-engine and
heat-api-cfn at the same time, the existing resource interface is
maintained with a deprecation warning (how long to maintain this
is TBC).
Change-Id: I453a24f78095dfa5b3a5311651b5f1ac40aa8b3f
blueprint: native-waitcondition
Mutables in the method params defaults might cause errors and
that's why it's anti-pattern in most of the cases and should be
removed.
Change-Id: I8bc284f12ce72082a0482410ec2c20c2fc087a4b
Closes-Bug: #1327473
Add convenience function to allow easy stubbing of keystoneclient
in all tests where explicit control and verification is not required.
This is a precursor to making all clients use the auth_token property
from keystoneclient (instead of using the context auth_token in
preference) such that trust tokens can be refreshed before expiry.
Partial-Bug: #1306294
Change-Id: I9ba4595b8750ff769e76972cc30b55a68253e76d
This changes the default behavior of Resource.handle_update to only
raise UpdateReplace if the properties are different. It allows updating
DeletionPolicy cleanly without deleting the resource.
Co-Authored-By: ala.rezmerita@cloudwatt.com
Closes-Bug: #1316171
Change-Id: I1d2864dc44ff7a5b4536b26f2dba525e01e56af0
This patch fixes all the missed and newly introduced violations of the H306
style checking rule and enables it in tox.
Change-Id: I5566e66421d5397c0103958f02ea38e6e3c68892
Implements: blueprint reduce-flake8-ignored-rules (partial)
The current approach of using the Metadata descriptor
class has some issues including:
* Unintended database queries on accessing a metadata attribute
* get/modify/set patterns since the attribute isn't backed by a real dict
* lack of control over whether to fetch metadata locally or from the db
This change creates Resource methods metadata_get and metadata_set to use
for reading and modifying resource data. This is a refactoring change only so
there should be no change in behaviour.
This change will help in the future with
Related-Bug: #1306743
Change-Id: I7cd87a071ac410a388d787f132c9aee194030714
This is no longer required because cleanup is provided via reset
of the dummy db in all tests which call the base-class setUp.
Change-Id: I49cbfce0b2880d0318114df35d4abaed61d03bfc
Move the setup/reset of the dummy DB into the test common base-class,
which ensures the setup/recent happens consistently (some tests setup
but then don't reset for example), and ensures there's always a clean
dummy DB per test.
Change-Id: I8e3bdd23399cb0d1d3c93daae66e6509b12b4e72
The WaitConditionTimeout message was using size of the reason
string as input instead of the actual number of status reasons.
Change-Id: I9ad1813755eda6924ffeff116eaeda9f36b601d1
Closes-Bug: #1297230
This patch is one in a series to re-enable H306 style check rule
(imports are in alphabetical order).
It touches second half of tests (starting from test_n*).
Implements: blueprint reduce-flake8-ignored-rules (partial)
Change-Id: I5561d90a67eb5dc882200d432fda6b162011ac41