Fix exceptions in update_stack

Updating an in-progress stack is not supported by Heat.  Previously, a
NotSupported exception would be raised.  This was not consistent with
other actions, such as abandon stack.  Instead, let StackLock.acquire
raise an ActionInProgress exception.  Suspended stacks will still result
in a NotSupported exception being raised if an attempt is made to update
them.

Closes-Bug: #1308109
Change-Id: Ic844b06cd654d7bd5d422bba81d1d8246a5d8dd0
Fix requirements_style_check on BSD platforms

On Linux, the sort command implicitly ignore non-alphanumeric characters
when sorting.  Since the '>' character has an ASCII value greater than
the '-' character, the following list will be sorted on Linux, but not
on a Mac:

SQLAlchemy>=0.7.8,<=0.9.99
sqlalchemy-migrate>=0.9.1

This makes sort explicitly ignore such characters and will keep the
tests consistent across different environments.

Closes-Bug: #1324945
Change-Id: I559ae4b4c3e2a7d190af9d4b1517dfaf23d114b1
Avoid double-initialisation of Resources

If a __new__ method returns an instance of its own class (including
subclasses), Python automatically calls the __init__ method on the instance
before returning it to the caller. Therefore, explicitly constructing a
subclass inside __new__ and returning it was resulting in __init__ being
called a second time. Instead, call object.__new__(), passing the subclass
that we want to instantiate.

Change-Id: I5f891fd97e4cabc6d4c39c5312a0185649702e75
Unit tests: Create resources with ResourceDefinition

Stop creating Resources with dicts that are snippets of templates, and
instead always use ResourceDefinition objects to create Resources.

Change-Id: I1587f1edf9b04f06bd435857d7c1ea2c1cc26058
Use ResourceDefinition in autoscaling

Compare resources using ResourceDefinition objects (which are both
comparable and hashable, and are independent of any one template format)
instead of passing around snippets of a template.

Change-Id: I3bb8bcd2ff54a699a901aac435a56b537d99e992
Handle HOT when converting Outputs to Attributes

When converting the Outputs of a provider template into Attributes of its
facade resource use the Template object (which translates the template into
a consistent, cfn-like format) instead of the raw template data, so that
HOT also works.

Also fixed an outdated (and therefore now misleading) comment.

Change-Id: Iba44ba56be3e1d756cdc01a2b6f4fba171a02057
Support passing a Template object to StackResource

The create_with_template() and update_with_template() methods of the
StackResource class previously took raw template data as an argument; this
change allows them to accept Template objects also.

Change-Id: I7af5d516d4d0c4085144ed53c962cfc6ca3c69bb
Allow a resource to be added to a template

Add a method that allows a ResourceDefinition to be inserted into an
existing template.

Change-Id: Ia418127d72d26a77d731f93cc0eb3a45d983cc82
Use add_resource() to build autoscaling templates

Instead of building nested templates for Autoscaling manually, use the
Template.add_resource() method to build them up programmatically.

Change-Id: Ie4d6a869355cf0ddb6fce0edc6c7d49b8a2b7e75
Add auth_token_info to request context

The auth_token (and other) middleware adds a keystone.token_info value
to the request environment after validating the token.  We can pass this
value via the request context which allow us to avoid always re-requesting
another token in the keystoneclient instance in heat-engine.

Change-Id: Icac0e73fbddd5011fb41bd644036ba489189c405
Partial-Bug: #1317293
Merge "Fix requirements_style_check on BSD platforms"
Merge "Avoid double-initialisation of Resources"
Merge "Unit tests: Create resources with ResourceDefinition"
Merge "Use ResourceDefinition in autoscaling"
Merge "Handle HOT when converting Outputs to Attributes"
Merge "Support passing a Template object to StackResource"
Merge "Allow a resource to be added to a template"
Merge "Fix exceptions in update_stack"
Merge "Use add_resource() to build autoscaling templates"
Merge "Add auth_token_info to request context"