Since https://review.openstack.org/#/c/31083/ we're using the
Resource.update() method to update the LoadBalancer, which requires
the resource snippet to be statically resolved (as is done in
parser.Stack for stack updates)
Zane Bitter [Tue, 18 Jun 2013 08:41:40 +0000 (10:41 +0200)]
Return None for physical resource name during validation
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.
Zane Bitter [Tue, 18 Jun 2013 08:25:52 +0000 (10:25 +0200)]
Standardise resource names in Invalid Attribute errors
These should always refer to the resource name in the template (i.e.
logical resource name), and never the physcial resource name (since these
errors necessarily occur during validation, before any physical resource is
created).
Jeff Peeler [Mon, 17 Jun 2013 16:19:49 +0000 (12:19 -0400)]
Add InstanceId property to EIP resource
This also changes the InstanceId property for an EIPAssociation
to not be required, which was necessary for testing and is inline
with AWS documentation.
Zane Bitter [Mon, 17 Jun 2013 15:42:04 +0000 (17:42 +0200)]
scheduler: Improve task descriptions in debug logs
Tasks that were simply defined as ordinary functions (not methods) were
identified by their repr() in the logs, which is only really desirable as a
last resort and for objects (where the __call__() method is the task). Use
the function name instead.
Angus Salkeld [Mon, 17 Jun 2013 04:39:19 +0000 (14:39 +1000)]
API support for Environments
Support "Environment" section in the create/update body.
We the roll up the parameters and the environment and send
that as json using the rpc "params" argument. So no changes
to the rpc layer are needed. The engine knows how to deal
with both formats in the Environments class.
Zane Bitter [Mon, 17 Jun 2013 10:24:49 +0000 (12:24 +0200)]
Use physical resource names with a short_id
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.
Steven Hardy [Fri, 14 Jun 2013 10:02:09 +0000 (11:02 +0100)]
Convert Resource to separate action/status
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)
Zane Bitter [Fri, 14 Jun 2013 10:31:23 +0000 (12:31 +0200)]
Store stacks in the database when running unit tests
If stacks are not stored in the database before they are create()'d,
anything that refers to a stack (e.g. Resources and Events) cannot be added
to the database either, and we get numerous errors in any output logs.
Zane Bitter [Fri, 14 Jun 2013 10:31:22 +0000 (12:31 +0200)]
Unit tests: Create User for testing AccessKey
An AccessKey resource is not independent of its associated User resource,
which must be present in the same stack. Consequently, we need to create a
real User resource that is a member of the same stack in order to test the
AccessKey in a realistic environment.
Zane Bitter [Thu, 13 Jun 2013 18:03:26 +0000 (20:03 +0200)]
Unit tests: Don't use mox to stub uuid.uuid4()
The wait condition unit tests require a fixed stack ID, but we don't want
to permanently stub out uuid4, since there are other potential uses of
uuids. Instead, just do it for that one operation.
Steven Hardy [Thu, 13 Jun 2013 10:19:32 +0000 (11:19 +0100)]
Convert Events to separate action/status
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)
Zane Bitter [Wed, 12 Jun 2013 10:48:25 +0000 (12:48 +0200)]
scheduler: Fix an issue with wrappertasks and exceptions
Using a 'for' loop on a generator is incompatible with calling throw() on
it, because the latter causes the generator to advance to the next yield.
Consequently, ignoring an exception from a subtask in the parent task would
cause the next subtask to be skipped.
This issue does not affect any existing code to date.
The inner and outer loops should each be equivalent to the definition of
"yield from" (http://www.python.org/dev/peps/pep-0380/#formal-semantics) in
PEP 380, with the following simplifications:
- Assume that the throw() and close() methods exist
- Don't support send()
- Don't support return values (these are Python 3-only feature)
Andrew Plunk [Tue, 11 Jun 2013 15:18:10 +0000 (10:18 -0500)]
Key error when auth in standalone mode
Fix a key error caused from the response of authing
in stand alone mode. The keystone docs indicate that
the schema for a response user name is ['user']['name']
rather than ['user']['username'].
Steve Baker [Wed, 5 Jun 2013 01:41:36 +0000 (13:41 +1200)]
Add Fn::Replace template function.
This is implemented with python str.replace
For yaml templates, this should be used as a better alternative to
Fn::Join: ['', [...]]
For json templates, the following common pattern:
"Fn::Join": ["", ["line 1\n", ... "line 2\n"]]
could now become more maintainable as:
"Fn::Replace": [{...}, "Fn::Join": ["\n", ["line 1", ... "line 2"]]]
Zane Bitter [Fri, 31 May 2013 10:52:30 +0000 (12:52 +0200)]
Make Fn::GetAtt add a dependency
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).
Steve Baker [Wed, 5 Jun 2013 21:41:44 +0000 (09:41 +1200)]
Use - instead of . for physical_resource_name delim.
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.
Simon Pasquier [Tue, 4 Jun 2013 14:42:50 +0000 (16:42 +0200)]
Fix instance creation when a network with no subnet is used
It is possible with OpenStack Networking to create a network with no
subnet attached to it.
When creating an instance associated to such a network, the engine would
raise a 'list index out of range' exception because the instance has no
IP address on the network.
The issue would also happen with a loadbalancer referencing the same
type of instance.
Thomas Herve [Fri, 31 May 2013 21:19:56 +0000 (14:19 -0700)]
Fix an intermitting failure in test_metadata_refresh
Given that resource creation can happen in parallel, the call to
check_create_complete may not follow the call to handle_create, so mock
those without checking the order.