Patch 044 migration to work w/ MySQL 5.6

With MySQL 5.6 setup to use UTF-8 for everything, the 044 migration
will fail. This is because a VARCHAR(256) cannot be indexed in UTF-8
databases. In versions of MySQL before 5.6, this produced a warning and
a truncated, less-useful index. In 5.6 it was changed to an error.

We will reduce these columns further to 64 bytes in the model in a
subsequent fix. For now, we will just create the table with 64 character
columns on new systems, which will allow this migration to work properly
on mysql-5.6. There is no danger of overflow, as 64 chars is what Keystone
uses for them anyway.

Change-Id: I73932f69ff662ef5bb030b6516bd3d32507de658
Related-Bug: #1316646
Add controller and action debug message in wsgi.py

Add controller and action debug message before calling api
controller to provide much more debug message when debugging api.

Change-Id: Ia1d05a3fd3574a63571838b6eb60f4db5bfef7f4
Add show_nested to list_stacks RPC interface

Add a show_nested argument, defaulted to False

blueprint: list-nested
Change-Id: I3468325b3b383bf671391989d91ed384ea158472
db API add show_nested to stack_count_all

blueprint: list-nested
Change-Id: I38e3bcba2e75253a3e77fd31f9db103f3ebab7b6
Add show_nested to count_stacks RPC interface

blueprint: list-nested
Change-Id: I60c25a34009028d45d73a10fe372abdf28ef043f
Add show_nested parameter to GET v1/stacks API

Adds an optional argument which can be used to enable listing of
all stacks, including nested stacks

blueprint: list-nested
Change-Id: I6546ddc549cb3eec769698f5b7ff2a921c2b31d7
Add "parent" key to list stacks output

Pass back the stack owner_id (parent stack ID) via the RPC API, then
expose it via the "parent" key when listing stacks.  This will be
None for all top-level (non nested) stacks, so can be ignored when
show_nested is not passed.

blueprint: list-nested
Change-Id: I5ad7f867bc7eb138bf2d7d17b4a3bf810d341393
Fix usage of environment section constants

Previously, constants were not being used or were being defined in
multiple places.

Change-Id: Iddd001392b77ac57d858a84daba66553a90465b2
Return full error message for HTTP errors

Non-HeatException, non-remote errors were getting their messages
truncated at the first newline and leaving incomplete error messages the
in json response.  We can only be certain that remote errors raised
through oslo.messaging will conform to the "message + \n + stack_trace"
formula

Closes-Bug: #1358417
Change-Id: I785c6e41101960ea7ceb00c0733c49c2a8aa909f
Additional exception type check for ceilo-client

This adds additional exception type checking for ceilometer client.
In addition to previous HTTPNotFound exception, ceilometer client lib
may throw an apiclient.NotFound exception directly.  Both cases should
be treated as 'valid' results from HTTP 404, so that the
ignore-not-found logic in Heat can work using either version of
ceilometer client.

Change-Id: Iedd061afe0cf039d5070257caf0d5a726213a8af
Closes-Bug: 1361128
Add a method to freeze a ResourceDefinition

Change-Id: Idcbdd0efbc9c3b38c39b8ac1e64e9057fad15899
Use ResourceDefinition as 'before' in resource updates

Replace the use of Resource.parsed_template() in updates with a frozen
version of a ResourceDefinition that uses the property values stored in the
database from the last update/create action, rather than calculated from
the template.

Change-Id: Id23ad60fbf98f2740ece2a337e795cfb3959d6f8
Implements: partial-blueprint update-failure-recovery
Allow an update after a failure

Change-Id: I41ce08c33780642c31b81763032d6c089e903c48
Implements: blueprint update-failure-recovery
Closes-bug: #1160052
Scheduler: Allow a grace period when cancelling tasks

Previously, we always cancelled a task immediately. This allows us to
optionally allow it to run for up to a specified maximum grace period
before being cancelled (this assumes that the task continues to be
driven by calls to step()).

Change-Id: Id7fcc9ecf5c1704d523826f1ba37411ffd479793
Allow concurrent tasks to complete after error

Add an option to allow concurrent tasks in a DependencyTaskGroup some time
to run to completion before being cancelled in the event of an error in
another task.

Change-Id: Ie3d63a0d5e8c9fa5f0fa74285b06f732685afcbc
Don't stop creates/updates immediately on error

When an error occurs during a stack create or update operation, don't
immediately stop the operation. Instead, wait up to 4 minutes for resoures
already in progress to complete before forcibly cancelling them. This
minimises the number of resources that will need to be replaced when using
the features from the blueprint update-failure-recovery to recover after
such a failed operation.

Change-Id: Ib08f3d8faea31f251a46fc0537983127f8ba2783
Add test for ResourceDefinition equality

ResourceDefinition objects compare equal if they are generated from
equivalent templates. Only the MRO stands between us and disaster (since
both superclasses - ResourceDefinitionCore and collections.Mapping - define
__eq__ methods), so add a test to confirm that we are getting the correct
one.

Change-Id: I8181f91f08fd81104fe493539511d6fd129522c8
Add missing "." to help strings

Make help strings consistent, add ".".

Change-Id: I3f5267b40abfbab3fb4b90bfe72c267ba4c10943
Detect neutron endpoint on-the-fly

This change does the following:
- reverts commit 04de60093b602c2eac4a612df5d4a2e31424a25d
- reimplements Resource.is_using_neutron to check for neutron by
  attempting to create a neutron client
- fix mocking in tests for changes which landed after 04de600

If there is no 'network' entry in the service catalog then
keystoneclient will raise an EndpointNotFound. The context will
already have a keystone client cached which has a full service catalog
locally, so calling is_using_neutron should have no particular overhead.

This fixes a tripleo regression where the autodetection is triggered
before keystone is ready, so that heat-engine fails to start. This
race does not affect devstack as keystone is fully configured before
heat services are started.

Not adding config option networking_service will also prevent
extra work required by downstream installation tools.

Change-Id: I45a6154fa560f672d8d1942bf57f39601110bfc6
Closes-Bug: #1362812
Rename docker directory to heat_docker

This directory was renamed in 4e8231, which made importing docker
(that is docker-py) difficult if not impossible in Python 2.x. So
rename it to something other than 'docker' to avoid that problem.

(setup.cfg has been modified with the new path)

Change-Id: I3cbb7c5d4b53f70e1dc6102881f8e05852341a9a
Related-bug: #1296758