Create common stack_create functional test helper

The same pattern for creating a stack, defaulting arguments,
setting cleanup, and waiting for status is repeated in all
tests, so move that logic to a common base-class helper.

Change-Id: Ibf4c2f61d1f1936816245178fd8cf794e347de8b
Fill test database from models description

Now Heat models are the same as the tables state in DB after migrations,
so we can use metadata.create_all() to fill a test database.
This will speed-up test database creation and reduce a necessity in DB
migrations on SQLite

Change-Id: Ib7b6ab2591c01e91d7a55f3384dae505fe1485a7
Add console_urls attribute to server resource

This is a composite attribute that returns a dict-like structure
lazily resolving the actual console URL based on key supplied or dict of
all available consoles if no key is provided.
Example of usage to get only 'novnc' console:

  outputs:
    console:
      value: { get_attr: [server, console_urls, novnc ] }

Change-Id: I27c0426f1a9100bb483f04c059fec87bb69b6340
Implements: blueprint vnc-console-attr
Co-Authored-By: Jun Jie Nan <nanjj@cn.ibm.com>
Consider invalid keywords a template validation error

This commit changes the exception type raised when an invalid
keyword is found in the resources and outputs sections of hot
templates from a KeyError to a StackValidationFailed. The
latter is better suited to be sent to heat-api to return to
clients, as oslo.messaging deserializes it to a more compact
exception that does not include the stack trace in the message
string.

Change-Id: I7c2da96fa07503b947c6c2c4a5f8ed3231dec9db
Closes-Bug: 1393831
Populate _template_classes global on first use

This change ensures that the _template_classes global variable is always
initialized when the first template is created. This was done when
instantiating the Template base class, but it was missed when creating an
instance of any of its subclasses.

Change-Id: I5edc9f06d6b48bb04e8ed41365823021ef133909
Closes-Bug: 1397468
Reduce Server update complexity to below 20

One of the goals to polish Heat code is to make sure the complexity is
below 20.  This patch refactors the Server resource implementation
regarding its update logic so that it meets this requirement.

This is a pure code refacto patch, so no test cases are modified.

Change-Id: I18c6ada4386c0a091ae1d369db91c6a3d6429f34
Add OS::Cinder::VolumeType resource

Add OS::Cinder::VolumeType resource, implement its
basic actions: creation, deletion, updation.

Change-Id: Id37f4a0b1c558caa83dbecf7b64f87241ea89cdd
Implements: blueprint cinder-volume-type
Always import heat.rpc.api as rpc_api

heat.rpc.api was being imported as rpc_api in some modules and engine_api
in other modules.  Always import heat.rpc.api as rpc_api for consistency.

Change-Id: Ic84ca7fbac7a95eace7f2019c08ee20fa1bc8e5e
ResourceGroup allow update of resource_def

Currently the group is replaced if the resource_def is updated,
but instead we should allow updates and update the underlying
nested stack instead.  This allows properties to be changed
such that non-replacement updates can be performed on the
resource-group members.

Change-Id: I471b7ebe71ed262a8b0e2c971a32afc7062699cb
Closes-Bug: #1396533
Closes-Bug: #1380612
Use the right log marker functions

According to [1] _LI() should be used for LOG.info(), _LE() for
LOG.exception() and LOG.error(), _LW() for LOG.warning().
The log marker functions must only be used when the message is
sent directly to the log.
Debug level log messages should not be translated.

[1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: Ib9f92ef6696b9a95ddae74f0d4a0a557c06ecc91
Fix invalid syntax on heat-db-setup

">=" comparison is only supported in certain shells.  This patch changes
it to "-ge" to fix this.

Change-Id: I2bf1294c31d38e18b02bebd190bd4bfa45beedc5
Closes-Bug: #1398535
Add cinder volume custom constraint

Add cinder volume custom constraint to validate
the existent of the volume not wait creation.

Change-Id: Idf4b7139eff2532e71aff48ff4a965c9e52a0921
Implements: blueprint cinder-custom-constraints
Support better access to nested attributes

This makes it easier to get access to attributes  with in
a nested stack.

bp env-nested-usability
Change-Id: I047794906ae7eb3b72b6cc779c64a9ba6e73e68a
Add support for pass through references

To make template resources more transparent we now support
the user adding an output "OS::stack_id" to a nested stack. This
is then used by get_resource in the outer stack.

Note: it is expected to use this as follows:
outputs:
  OS::stack_id:
    value: {get_resource: my_server}

bp env-nested-usability
Change-Id: I6016699514e75bd88c27f9f8f7d871b39d31343d
Make all assertEqual() calls conform to convention

It is a convention to have assertEqual() assertions invoked with
'expected value' before 'actual value', or else the debug output may
become very confusing.  This patch fixes about 100 violations in current
test cases where about 3580 assertEqual calls are made.

Closes-Bug: 1259292
Change-Id: I2e0474d9821716baf35a3bbb2952c63a84749dd3
Merge "Make all assertEqual() calls conform to convention"
Merge "Fix invalid syntax on heat-db-setup"
Pass status reason when trove misbehaves

Pass a helpful message when trove fails to initialize
successfully. Only include codes for BAD_STATUSES.

Change-Id: I0c0d3b44640130b80734464af93151387d513f5a
Closes-bug: #1386899
Merge "Pass status reason when trove misbehaves"
Implement handle_check for Rackspace Cloud Servers

This allows Rackspace::Cloud::Server to perform a sanity check when
doing a stack.check()

Change-Id: I2300a3d1f5f83969a398e8ac11656e181bc744a6
Implements: blueprint stack-check