Much of the code of InstanceGroup was able to be deleted in
preference for using the native functionality of StackResource.
InstanceGroup now generates a template and updates the nested
stack when it needs to be created or resized.
Luis A. Garcia [Tue, 23 Jul 2013 23:59:32 +0000 (23:59 +0000)]
Small tweaks to recreation of remote errors
The patch adds heat common exceptions to the list of trusted exceptions
that can be re-spawned across RPC calls (this is the default behavior
for all OS components). The patch adds the corresponding package to the
declaration of the allowed_rpc_exception_modules as well as to the conf
sample.
Luis A. Garcia [Thu, 18 Jul 2013 00:49:49 +0000 (00:49 +0000)]
Enable localizable REST API responses via the Accept-Language header
Add support for doing language resolution for a request, based on the
Accept-Language HTTP header. Using the lazy gettext functionality, from
oslo gettextutils, it is possible to use the resolved language to
translate exception messages to the user requested language and
return that translation from the API.
The patch removes individually imported _() so they don't replace the
one installed service-wide.
Also, it adds the ability to fully re-create a remote error
with the same kwargs with which it was originally created, so that we
can translate it and show it to the user.
Zane Bitter [Fri, 2 Aug 2013 12:48:54 +0000 (14:48 +0200)]
Include the resource and action in ResourceFailure exceptions
An update operation performs 3 different kinds of actions on resources
(update, create and delete), and we may want to handle failures differently
depending on the action.
Zane Bitter [Fri, 2 Aug 2013 16:55:30 +0000 (18:55 +0200)]
Rackspace: Don't raise ResourceFailure exceptions
ResourceFailure is meant to be a wrapper around other exceptions that's
invoked by top-level resource operations; don't use it as an all-purpose
exception.
Luis A. Garcia [Tue, 23 Jul 2013 20:32:51 +0000 (20:32 +0000)]
Sync gettextutils from oslo
The oslo changes necessary for delayed translation were refactored in
oslo. This patch set brings in the refactored changes, implemented
under the same change-id mentioned below.
Steve Baker [Sun, 28 Jul 2013 21:23:54 +0000 (09:23 +1200)]
Rename rackspace server ImageName, Flavor, UserData.
Justifications for each rename are as follows:
- ImageName -> image: the Nova API uses imageRef, however heat does
a lookup from image name to id, so 'image' covers either name or id.
- Flavor -> flavor: the Nova API uses flavorRef, but in the future heat
should be able to do a lookup on the flavor name as well, so calling the
attribute 'flavor' will API future-proof that change.
- UserData -> user_data: maps directly to Nova API
Steve Baker [Mon, 29 Jul 2013 22:56:52 +0000 (10:56 +1200)]
Stop delete polling after status == DELETED.
A rackspace server can be in status DELETED for some minutes
until a 404 is raised. This change speeds the deletion of a stack
by considering the resource deleted as soon as the status changes
to DELETED.
But the first unit tests to check the value passed to Cinder for the AZ,
introduced in 134b11ccd145f982b7173bc9a5d0f1bc3e8eef8c, just forced the
value instead of obtaining it from the Instance.
Add a unit test to check the common case, and fix the resulting error (an
empty string is returned instead of None).
Allow the Ceilometer Alarm to be used with cfn-push-stats
This is for when:
- Ceilometer does not support the desired custom metric
- Easier migration to Ceilometer Alarms (reuse most of old templates)
A watchrule is create within the Ceilometer alarm, but it is marked
as belonging to Ceilometer. This is used in the follow situation:
- So we can figure out that we don't need to run the watch periodic task
- when we receive new sample data we can forward the data to Ceilometer
Steve Baker [Sun, 28 Jul 2013 20:43:17 +0000 (08:43 +1200)]
Assign rackspace server name from physical_resource_name.
The default implementation of physical_resource_name() assigns a name
which includes some context and randomness.
physical_resource_name() is overridden to optionally allow the 'name'
property to specify the physical name. The same technique is used in
OS::Swift::Container, and 'name' matches the property in the underlying
Nova API.
Steve Baker [Sat, 27 Jul 2013 04:06:44 +0000 (16:06 +1200)]
Replace rackspace PublicKey property with key_name.
This fetches a keypair that is registered with nova and
uses the public key, instead of having to specify the entire
public key as a launch parameter.
Tested to work on instances launched in DFW.
This shares the keypair lookup method with AWS::EC2::Instance but
adopts the property name of the underlying nova API. This property name
will align with the yet-to-be-written OS::Nova::Server.
Steven Dake [Tue, 30 Jul 2013 01:18:19 +0000 (18:18 -0700)]
Replace part_handler.py with write-files cloudinit mechanism
part-handler.py was acting as a write-files mechanism. Instead just
use the write-files mechanism directly to avoid the complexities of
the part-handler.
This change is a small correction to my previous change that was
already merged(bug #1204601). Below given code snippets show the
one line code change
(Please note the change in return statement in below code)
code before this change:
for link in dbinstance.links:
if link['rel'] == 'self':
return dbinstance.links[0]['href']
code with this change:
for link in dbinstance.links:
if link['rel'] == 'self':
return link['href']
In validate_template check if we have a dict before we try to
get 'Type'. We also need to check the response back from
validate_template to see if there are any 'Error'(s) and present
that back to the user.
Initialize resources to DELETE-COMPLETE if missing during stack delete
If the parent stack is being deleted and a given resource cannot be found in
the data store, initialize its state to DELETE:COMPLETE instead of
INIT:COMPLETE.
current implementation of rackspace database resource
_resolve_attribute method assumes that clouddatabase object's
hostname and href are set to correct values and just returns
them, but that assumption is not correct. With this change,
hostname/href is retrived if it was not set already.
Steve Baker [Fri, 26 Jul 2013 23:37:32 +0000 (11:37 +1200)]
Functions documentation cleanup.
- Switched to definition lists for parameters to be consistent
with generated resource docs
- Make consistent the layout of literal blocks and returns
- Other minor grammatical and layout fixes
Jason Dunsmore [Wed, 24 Jul 2013 20:07:41 +0000 (15:07 -0500)]
Support any distribution without UserData/MetaData
A template without UserData or MetaData sections should work with any
distribution, regardless of whether or not a setup script exists for
it in the Cloud Servers resource. The setup script only exists so that
the UserData and MetaData sections will configure the server.
Allow template resource use outside of Environment
In addition to using TemplateResource as a means to override another Resource
implementation, this allows template authors to specify a template url
as the Type of resource directly. This allows a user to define new Resource
implementations in addition to overriding existing ones via Environments.
Steve Baker [Thu, 25 Jul 2013 21:04:12 +0000 (09:04 +1200)]
Auto-document all resource types.
There are separate pages for OpenStack, AWS and Rackspace resources.
Currently the following sources are used for resource type documentation:
- the docstring for the resource class
- properties_schema
- attributes_schema
Passing e.g. a string as the AllowedValues list can appear to work, since
str.__contains__() performs a substring match. It's better to fail fast, so
convert AllowedValues to a list regardless of its initial type.
Andrew Plunk [Fri, 12 Jul 2013 14:56:07 +0000 (09:56 -0500)]
Generate a template from a resource implementation.
Using the properties and attributes schema in a
specified resource, generate a template where
all properties have been mapped as parameters,
and all attributes have beeen mapped as outputs.
Jianing YANG [Thu, 11 Jul 2013 15:17:52 +0000 (23:17 +0800)]
make heat-api return a parsable error
add a wsgi middleware (faultwrap) that catches exceptions
and transform those exceptions into a parsable format
according to 'Content-Type' of the request.