Similar to properties, adds attribute_schema and attributes members to
Resources in order to facilitate document generation and template
provider stubs for resources.
Change-Id: I5e207360816fbc685c66db68a7fab8afad11bf10
Implements: blueprint attributes-schema
During template validation, the resources have not been stored in the
database. Therefore any resources that return self.physical_resource_name()
in either FnGetRef() or FnGetAtt() would cause assertions whenever either
of those functions were called during validation. Instead, return None from
physical_resource_name() in this phase, as we do for other data that is not
available yet during validation.
Fixes bug #1191931
Change-Id: I1a5b17557ae1ca2600fb930e74eb5248c82e0326
at this point the concept only exists in the engine, the
api and client changes will come in later patches.
blueprint environments
Change-Id: I3e208bb72a04bf275bead2aec89006cf680b501b
The short_id is a random, but stable, 12-character alphanumeric ID.
This will allow two resources of the same name to exist concurrently. That
is necessary for resources to be replaced during an update without
interruption.
Change-Id: If32904a47c6f8fb651e317ce91f2a04f6eadcc0b
Refactor to abstract the handle_create/check_create_complete
logic, so it can be reused without lots of duplication for
other action transitions
Prompted by review comments from:
https://review.openstack.org/#/c/31982/2/heat/engine/resource.py
related to blueprint: stack-suspend-resume
Change-Id: Idb18913ef6ff700b63d5ec6d340d2353fc2294b7
Next step in decoupling action/status
This adjusts the Resource DB columns, model and class to be consistent
with Event, and split action/status. This also modifies the both APIs
to join the action/status to avoid changing the API (we can't change
the CFN one anyway and it's desirable to avoid breaking compatibility
with the ReST API, or needing a version bump for this simple change)
Change-Id: I02b56eb14045a058e67b9764d386530d555c339e
First step in decoupling action/status in Resource
This adjusts the Event DB columns, model and class to split
action/status, but in order to be backwards compatible we set the action
to None, which means we can do the right thing in the CFN API, and
resource_status still maps correctly to what is expected in
python-heatclient (which will need to change after the Resource
action/status split happens)
Change-Id: I261d47d2a3fdb3cdc2a8aaf6c159763f4636f633
Both heat and oslo now require the version of greenlet containing
the fix (greenlet>=0.3.2) so we no longer need this workaround
Change-Id: I42af8e020f08480dda08f4b4879c2840e741ea59
This will ensure that resources which get attributes from other resources
are not created until the latter resources are available.
An audit of all the templates in the heat-templates repo revealed that in
only one case did this cause a circular reference, and it was the template
that appeared to be incorrect (it has since been fixed).
Change-Id: Ibd51acdda55c24f665c5ca887040f3564d952c0e
Avoiding using . means that instance hostnames are unique within the stack
(and within the tenant).
This solves 2 real-world use cases:
- tripleo issue, as described in bug: #1184713
- OpenShift template resorts to setting the hostname to ec2_instance_id
This may have an impact on users who are scripting to assume . delimiting,
however this will only affect newly created stacks after this change is
deployed.
Fixes bug: #1184713
Change-Id: I5a8eb358ea9c52162eb9263b9f9e6dcf750d787b
Move the update_template_diff and update_template_diff_properties
functions into resource.Resource - since they now raise
resource.UpdateReplace we can avoid ever calling handle_update if
the resource update will result in replacement
Note a further cleanup will probably be to combine the two diff
functions into one recursive diff, which will further simplify this
Change-Id: I839f0c4448a2d869f35e0a4f19d17f31c5c6f9af
Replace the handle_update returned value with a new ResourceReplace
exception, which allows the replacement logic in resource.py and
parser.py to be cleaner
Change-Id: If652d031e8baeb8f4c6015e5ed2d0e5bb25f0fc6
Fix some issues spotted in https://review.openstack.org/#/c/29543
These errors were spotted after the patch was merged, the
ResourceFailure exception takes an Exception not string argument
Change-Id: I72045ecf147c66a0a1cf1ef5df7fb3be8100384d
We have some aws-isms in the update code related to different
update states, which is not actually used anywhere, so may as
well remove it - it's probably easier at least for now to focus
on the three update states of COMPLETE/FAILED/REPLACEMENT
Change-Id: Ieeaf92ab0fec6bbfab3dddf2d8fecb0b38c1b2fc
The current update code uses a nasty pattern where returning an
arbitrary string from Resource.update is interpreted in parser.Stack
as an error. Instead use exceptions which is much nicer :)
Change-Id: I2ddebfd6bbec3dc229012406da72dd928fcc4595
Rename handle_snapshot() to handle_snapshot_delete() to better reflect what
it needs to do (both take a snapshot of the resource and then delete the
resource). Also, pass the state of the resource prior to delete being
invoked, since the resource may want to use different error handling in the
snapshot phase depending on e.g. whether the resource was created
successfully or not.
Change-Id: I1e5aaab4f13e42333c1f2f39bfeb0ebf2ac89ed8
Rename check_active to check_create_complete, since "active" is
really a detail of Instance state, and so it seems wrong for other
resources which take a long time to create but are not Instance
based (e.g WaitConditions). This change will also allow us to
align other stack "state check" functions with the state we're
checking for in a consistent way (e.g check_delete_complete etc)
Fixes bug #1178591
Change-Id: I55a824e6ba3de87cedd0b844e7f4e1294917533a
This handles the Snapshot DeletionPolicy in the AWS::EC2::Volume
resource, creating a backup of the volume before deleting it. It
requires a recent cinder client with backup support.
Implements: blueprint volume-snapshots
Change-Id: Idbb14a434ad6ccde9f198e07799e8aef0867dd6f
This improves validation of the different values, and make the Retain
policy works for all resources.
Fixes: bug #1160779
Change-Id: Idb0d275c44661db341f693d9d80629661d66c7ac
At the moment, we will just run each co-routine to completion, but in
future we can use this to return control to the caller so that resources
may be created in parallel.
Change-Id: I5c2daf3839e53d855acb73fc4288b5be76794c7f
Previously resources would be left in the CREATE_IN_PROGRESS state in the
event of a timeout or the thread being cancelled (due to a delete being
requested while the stack was still being created). We should instead put
these resources into the CREATE_FAILED state when this occurs, thus
creating an event with the reason.
Change-Id: I05956aa9ef26941b79cef9dbf0cb6a347047d199
All resources that implement check_active() will require some state to be
retained from the call to handle_create(). Saving this as state in the
Resource object results in repeated, ugly, and potentially error-prone
code.
Instead, allow a subclass-defined state object returned from
handle_create() to be passed to check_active(). This ensures that the state
is limited in scope to where it is meaningful (during the create
operation), and that it will be garbage-collected at the appropriate time,
even if an unexpected exception occurs e.g. because a thread is cancelled.
Change-Id: I9d690b44a066aaf33970562a2b9a55c633a7d4e8
To do otherwise risks leaving resources silently running that exist but
have experienced some kind of error during creation.
Fixes bug 1165023
Change-Id: Ie60fb053b1a596d102ca1b6a8429dd50ed41ff92
The resource delete operation attempts to delete CREATE_FAILED
resources. Further it attempts to delete resources that were
not created during a creation operation because further processing
of the template does not take place.
This patch special cases these two conditions in the delete operation.
Change-Id: I1c83ba68754f38a0f7e91e77fcf02177c457504e
Fixes: Bug #1155824
The resource.py GenericResource type is only used in tests, so
move it into the tests area, such that it can't accidentally be
used in the main heat codebase when we fail to import any resource
plugins..
Change-Id: I3912cc540903002a6dd5109e7ce51c7eb67ebf10
This is to make sure that as the update progresses and dependant
resources are modified/replaced that we compare the original
dynamic data with the current.
bug 1134258
Change-Id: Ia4e474e914aa9e99e5e569c4f2276beb55798421
Rework usage of properties.validate() so that we always
catch the error and set the resource state to failed when
a properties validation error occurs
fixes bug 1146529
Change-Id: I4c5b24cc29a19a5170852aa7626031f9612b3272
Re-resolve the template static data before creating the resource,
or we resolve the wrong value for the AWS::StackId pseudo parameter
which is updated after the parser.Stack gets stored.
ref bug 1131666
Change-Id: I68e87366d379356fd7f2685367300abe5594d6f6
We need to compare the runtime resolved resource snippet, since that
is what we get back from self.parsed_template. If we don't do this,
then we get a false positive when a Ref to a parameter which gets
updated (e.g AWS::StackId) is used in the resource properties.
ref bug 1131666
Change-Id: Ib488c43b9eca998a7a82b7571097f5bb69ef946c
The point of this change?
- You have another instances' ip in your metadata and if it
gets restarted you want cfn-hup to see the new ip.
How is it achieved?
- poll for the metadata so you can see these changes (cfn-hup)
- when ever an alarm action is run we make sure the metadata is refreshed.
bug #1131024
Change-Id: I0798c4da9689b126c3c98cafa63138ff2c484ea9
Avoid the possibility of returning an empty string (when Exceptions
have not got a string message), or parser.py will treat the error
as success and the resource operation failure will not be correctly
reflected in the resource state.
fixes bug 1130270
Change-Id: I1c55dea1f9615cd4b037802ff8c1066694bffea6
Add update_template_diff_properties to make comparison of
pre/post update resource properties easier
Change-Id: Ic37d37ae510a62739d4cc4219cfd69479a87767d
Signed-off-by: Steven Hardy <shardy@redhat.com>
get(k) returns None anyway if k doesn't exist, so the default to
None is not needed
Change-Id: Id954c510a5c4795b5e0c3ccdcca186983dee2e8f
Signed-off-by: Steven Hardy <shardy@redhat.com>
Add method to top-level Resource class update_template_diff()
which allows us to determine the difference between old/new
templates for a resource update, and also raise an error
if the changed keys are not in the list of those defined
as supported for update by the resource
ref blueprint instance-update-stack
Change-Id: Ibef07a0cecbc15f7f1d6c2c663743e3af8023057
Signed-off-by: Steven Hardy <shardy@redhat.com>