Steven Hardy [Wed, 4 Jul 2012 14:41:20 +0000 (15:41 +0100)]
heat API : Convert API to use HeatAPIException subclasses
Covert API to use HeatAPIException subclasses, instead of
plain webob exceptions, which cannot be correctly serialized
by the wsgi controller, and map engine errors to API exceptions
so the raw engine exception is not propogated to the user.
ref #125
fixes #150
Change-Id: I164c71e12ed29f40ad67188b645ca7ad2fa1fee8 Signed-off-by: Steven Hardy <shardy@redhat.com>
Make Stacks the owners of their own DB representation
Change the way that Stack objects are initialised, so that they know how to
load and store themselves in the database (they were already updating their
own data, but the actual creation was being done externally). This
consolidates a lot of existing Stack database creation code (in the
manager, nested stacks and unit tests) into one place.
Also, split the template and parameter handling out into separate classes,
and pass these through the constructor for easier testing.
Steven Hardy [Fri, 29 Jun 2012 12:08:47 +0000 (13:08 +0100)]
heat API : Make CreateStack work with boto
Further API rework to make stack creation work via boto
- Use webob.request.params not GET, as boto passes POST parameters in body
- Wrap CreateStack response in CreateStackResponse as expected by boto
- Add API debug for JSON format responses
- (second version in stackforge due to long-line fix)
ref #125
Change-Id: I347368ee0395a9019fae69a06e45260379ed7722 Signed-off-by: Steven Hardy <shardy@redhat.com>
Angus Salkeld [Wed, 27 Jun 2012 05:20:45 +0000 (15:20 +1000)]
Store the user parameters in the stack table
This allows us to use the raw template + the parameters
in place of the parsed_template.
Using the parsed template we lose the dependancy information
that is necessary when deleting the stack.
Jeff Peeler [Mon, 25 Jun 2012 16:47:23 +0000 (12:47 -0400)]
Add keystone create script for devstack
Copied from heat-keystone-service, with two differences:
The keystone endpoint-create command has been deleted. Devstack uses the
templated catalog driver by default, which does not support this
command. (The equivalent operation is handled manually elsewhere.)
keystone user-role-add parameters have slightly different names,
requiring _id suffixes.
Change-Id: I3d56becde7b6fedbe29e1cfc6a2b4ad9ab2621fa Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
Ian Main [Fri, 22 Jun 2012 15:48:23 +0000 (08:48 -0700)]
Factor out authenticate method for engine.
This patch factors out an authenticate() function for use by both
the heat service authentication and the resource authentication.
This fixes the AWS auth method for creating resources - issue #153.
Change-Id: I134e993263ae6ba4890f56bfbe6a6a3205b7f921 Signed-off-by: Ian Main <imain@redhat.com>
Ian Main [Fri, 22 Jun 2012 16:55:17 +0000 (09:55 -0700)]
Fix metadata startup.
A previous change to wsgi init caused the metadata to break. This
makes the 4th argument to init optional allowing other wsgi apps to
continue to work as normal.
Change-Id: Ib0e7042f656a9319013dba4e30c7ffa35cb85f92 Signed-off-by: Ian Main <imain@redhat.com>
Zane Bitter [Fri, 22 Jun 2012 15:30:28 +0000 (17:30 +0200)]
Fix path to cloudinit directory
The various path manipulations designed to search for the cloudinit
directory do not work with the current installation script, or when
heat-jeos is also installed. They also perform gratuitous manipulation of
sys.path (causing warning messages) and may pick up the cloudinit files
from a different location to the code that is actually running. Python
already knows which heat package we are using - just look for the directory
inside there.
This patch also tidies up the code for generating the user data.
Steven Dake [Thu, 21 Jun 2012 22:05:00 +0000 (15:05 -0700)]
Remove service name from nova() def
The service_name field is not unique between distros or versions of
openstack, but is used to select endpoints for communication with nova
and volume services. The nova client will sort out the correct operation
based upon the service_type field.
The service_name field should probably just be removed from the API
definition upstream.
Tested on F16 & Devstack U12.
Change-Id: I36409dba9d9ec2b453a027fc1e2e78f7c8ace2a2 Signed-off-by: Steven Dake <sdake@redhat.com>
Steven Hardy [Thu, 21 Jun 2012 09:52:25 +0000 (10:52 +0100)]
heat API : Add support for ContentType=JSON query parameter
From reading the boto code, and looking at real AWS API responses
it would appear there is an (undocumented?) AWS query parameter
which switches response format from XML (default) to JSON
ref #125
Change-Id: I7c8b0f5701be5ff8bd0a3b135e42cf0e46e39ded Signed-off-by: Steven Hardy <shardy@redhat.com>
Tomas Sedovic [Tue, 19 Jun 2012 12:54:27 +0000 (14:54 +0200)]
Make the describe-resource API calls user-aware
Fixes #143
The stack retrieval DB calls were already fixed in previous commits but
there was still one query (resource_get_by_physical_resource_id) that
would return any resource, not just the ones owned the user.
Angus Salkeld [Wed, 20 Jun 2012 11:24:44 +0000 (21:24 +1000)]
Make the saving cfn-signaling more reliable
1) The metadata saved in manager.py was not always showing up
in the db (from wait_condition.py)
2) Reuse a little method in parser.py to retrieve the parsed_template
db entry (and store the parsed_template_id).
Steven Hardy [Mon, 18 Jun 2012 10:30:50 +0000 (11:30 +0100)]
heat api/engine : Reworked approach to aligning with AWS date format
Modifies heat internal default date-string representation to match AWS spec
Note heat.common.utils.strtime default format loses sub-second precision
Avoids having to regex mangle datetime string format
ref #125
Change-Id: I1347e82b1c3ccac5eac7c85858cf8009723547c2 Signed-off-by: Steven Hardy <shardy@redhat.com>
Steven Hardy [Sat, 16 Jun 2012 07:39:10 +0000 (08:39 +0100)]
heat API : Align time format with AWS spec
- Reformat ListStacks/DescribeStacks responses to align time format with AWS spec
- Remove duplicate member tags in DescribeStacks (now handled by XMLResponseSerializer)
ref #125
Change-Id: Ib001acba591dba52f3f56052427d2b298d781ea0 Signed-off-by: Steven Hardy <shardy@redhat.com>
Zane Bitter [Sun, 17 Jun 2012 14:05:57 +0000 (16:05 +0200)]
Move parsing of parameters out of template parser
The format of the params received by the manager is a property of the Heat
API protocol, not of the template, so it makes sense not to have the parser
extracting the template parameter data from them. This simplifies the
implementation of #123 (Nested Stacks).
Zane Bitter [Sun, 17 Jun 2012 14:05:57 +0000 (16:05 +0200)]
Get stacks from the DB by either name or id
This code was previously misleading, as it appeared to get stacks by id,
but actually got them by name. This patch adds a separate API, so
get_stack() gets the stack by id and get_stack_by_name() gets it by name.
Zane Bitter [Fri, 15 Jun 2012 14:19:08 +0000 (16:19 +0200)]
Fix latest DB migration script
Unfortunately, as long as the user_creds_id column is not nullable the
script will still fail if there is data in the database. However with this
patch it is at least left in a recoverable state. Also, downgrades now
work.
Zane Bitter [Tue, 12 Jun 2012 14:23:35 +0000 (16:23 +0200)]
Raise NotFound exceptions from database
Raise a specific exception (NotFound) if something is not found in the
database. Then we can match on this exception, rather than searching the
error message (which effectively makes the text of error messages part of
the API).
Zane Bitter [Tue, 5 Jun 2012 07:46:10 +0000 (09:46 +0200)]
Tidy up Resource creation and deletion
Most of this code is common between resources, so put it in the parent
Resource class and have subclasses provide handle_create()/handle_delete()
methods for all their extra needs.
Ian Main [Fri, 15 Jun 2012 00:46:12 +0000 (17:46 -0700)]
Add a user creds database table and associate stacks with username.
This patch takes the credentials passed in from the context and allows
you to store them in the database in the 'user_creds' table for later
use with HA operations. It also adds a 'username' to the stack table
for direct comparison and user validation to support per-user stacks.