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 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.
Zane Bitter [Fri, 31 May 2013 19:34:36 +0000 (21:34 +0200)]
scheduler: Fix inifinite loop for no-wait tasks
When a task run by a DependencyTaskGroup completed immediately (i.e. it
was marked as done right after calling start()), the corresponding entry in
the dependency graph was never removed. As a result the DependencyTaskGroup
would continue running forever (or until it timed out).
Zane Bitter [Fri, 31 May 2013 10:39:08 +0000 (12:39 +0200)]
Implement timeouts for nested stacks
This also means that if no default is specified, nested stacks will not
time out (previously they used the default timeout of 60 minutes). Of
course, like other resources, creation of the nested stack will stop if and
when the parent stack times out.
Steven Dake [Fri, 31 May 2013 00:37:41 +0000 (17:37 -0700)]
Clarify a comment which says we require KeyName - which is incorrect
The Nova create API requires a name, image, and flavor. The key_name
is not mandatory. Possibly in AWS InstanceType (flavor) is not
mandatory but it is with Nova.
Monty Taylor [Thu, 16 May 2013 16:28:24 +0000 (09:28 -0700)]
Add CONTRIBUTING.rst file.
We don't use github pull requests, but we'd like to make that clear
to people if they show up at github and try to do one. github will
display the content of this file on the pull request submit form
if it's there.
Zane Bitter [Wed, 29 May 2013 07:25:30 +0000 (09:25 +0200)]
Clean up DB migrations when running unit tests
When doing development work, all kinds of issue can result when moving
between versions of the code that have added/removed DB migration scripts
if the compiled .pyc files are left behind. To save the need to do this
manually, remove all of the .pyc files when the unit tests are run.