Fix signal handling for WSGI servers

Previously, sending a SIGHUP to the parent process would close the
shared socket used with all the WSGI servers (problematic when multiple
workers are present). Also, exiting the wait loop in the parent would
cause the children to be orphaned. Instead, make the parent process
restart all the children servers upon receipt of SIGHUP. This behavior
seems to make sense given that sending SIGHUP to a child restarts and
creates a new server (due to the parent handling of the children).

Another fix was to issue a SIGTERM upon Ctrl-C in order to not leave
parentless children. SIGTERM was chosen instead of SIGINT simply to
avoid worker tracebacks on the terminal.

Minor unrelated change: the WSGI server in single worker mode has been
changed to also respect the debug flag, exactly the same as with
multiple workers.

Note: the original bug report was examining lack of signal handling
based on the Oslo service code. However, only the engine makes use of
it.

Change-Id: I8519cc6fedf72b38a8ce0762bb86cd70e58e0dc7
Closes-bug: #1276694
Deny updates to AWS::EC2::VolumeAttachment

In accordance with AWS docs [1] AWS VolumeAttachment does not support
updates of any of its properties.

[1] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html

Change-Id: I6d79536c68bed60d9b86c662147e35a9b2da6c1c
Closes-Bug: #1340096
Don't import Properties class directly

Import the module, as required by H302:
http://docs.openstack.org/developer/hacking/#imports

Change-Id: I9dd15d2404bed0206442724c9b681b7f17ebea60
Error class can accept message with format characters

Since the Error class is designed to simply accept any message string,
treating the message text as a format string causes errors if the
error message has format characters. This changes Error to have its
own format string that just echos the passed in message.

Change-Id: I1161d5e177dff860e180f845405d536e18222b23
Closes-Bug: 1361471
ResourceGroup build from list of resource names

This changes ResourceGroup internal implementation to be driven by
a list of resource names rather than a count of resources.

This maintains the current behaviour of sequential number resource
names, while allowing subclasses to choose a completely different
resource name scheme.

Change-Id: I17d046155f8d830ced789ede6a969ac4f125576d
Partial-Blueprint: deployment-multiple-servers
ResourceGroup make do_prop_replace class method

This refactor allows subclasses to override _do_prop_replace so
that properties can be populated by the specific needs of the subclass.

Change-Id: I1ebe382b8efd010e128fa9c452d5ddb580237c1e
Partial-Blueprint: deployment-multiple-servers
Provide access to outputs from OS::Heat::ResourceGroup

To align with the related OS::Heat::AutoScalingGroup change:
Ib9e830e0c54602ac456d64179e1df30f0778906d

This adds an 'attributes' attribute to the OS::Heat::ResourceGroup resource
so that the following:
  {'get_attr': ['my_asg', 'attributes', 'networks', '<network_name>', 0]}
returns a mapping from resource names to the corresponding IP addresses.

There is no need for an outputs_list attribute since the following already
returns a list:
  {'get_attr': ['my_rg', 'networks', '<network_name>', 0]}

To align ResourceGroup with OS::Heat::AutoScalingGroup, there will
be a proposed change to OS::Heat::AutoScalingGroup to rename the
following attributes:
- outputs -> attributes
- outputs_list -> attributes_list

Change-Id: Id51f23533ae75ca5d883a4f67e75ac9513a67264
Implement OS::Heat::SoftwareDeployments

This is a resource which subclasses ResourceGroup to deploy a group
of OS::Heat::SoftwareDeployment resources

The main difference in properties between this resource and
OS::Heat::SoftwareDeployment is that it has a 'servers' property
instead of 'server'. The servers property expects a map of
resource-name/nova-uuid pairs. The resource name is used as the
deployment resource name inside the group, and the nova-uuid is used
as the server to deploy to.

The attributes deploy_stdouts, deploy_stderrs, deploy_status_codes
each return a map where the key is the server name and the value
is the respective attribute from the deployment resource.

Change-Id: Ide1e8fb57d45062e5d459b484135a5cad6d2c7dc
Partial-Blueprint: deployment-multiple-servers
Implement OS::Heat::StructuredDeployments

This is a resource which subclasses SoftwareDeployments to deploy a group
of OS::Heat::StructuredDeployment resources

Change-Id: I5f9603c68bb7cd81ef60a6b2ba965e5b8e93887a
Implements-Blueprint: deployment-multiple-servers
Replace marconi by zaqar in heat plugins

Change-Id: I9eb68c27e79782f0da0d9a79bf231e09f2f679bc
Implement OS::Sahara::Cluster resource

* This patch implements resource for Hadoop cluster provisioned by
  Sahara based on Sahara's cluster template.
* Heat template for stack based on this resource should have minimal set
  of fields needed to provision cluster.
* To successfully provision cluster the following steps should be done:
  - Sahara enabled and working in your env
  - Sahara contains valid cluster template [1]
  - Sahara's image registry contains registered image with preinstalled
    Hadoop components [2]

[1] http://docs.openstack.org/developer/sahara/restapi/rest_api_v1.0.html#create-cluster-template
[2] http://docs.openstack.org/developer/sahara/devref/quickstart.html#upload-image-to-glance

Co-Authored-By: Pavlo Shchelokovskyy <pshchelokovskyy@mirantis.com>

Implements: blueprint sahara-as-heat-resource

Change-Id: If470511cbb88349f47a61a35b1a19ba7c68efd83
Save files while updating a template.

When updating a template object, any updates to the files must also be
saved in the database. With this change, updates to files of a template
are also saved in database.

Change-Id: Ia5b84780158c47ffe807829ce2fc83f4ffbb6db3
Log translation hint for Heat.tests

Currently, Log translation is motivated by oslo's move to prioritized
translation of strings, as documented at
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation

- add log translation hints for warning, error and info levels
- move from LOG.warning to LOG.warn
- remove use of % as a string formatter, use the log functionality
  instead

Partial implements blueprint log-translation-hints

Change-Id: Ia961196df09d301b4c384ffe51413ffc5c15164e
Refactor nested stack create/update/preview

The bug #1357433 was caused by the fact that stack parsing for a stack
resource on create/update/preview is pretty similar but repeated in all
three places.  This refactors them to move common logic to a single
place, making sure all validation in consistent and all params are
passed in the same way.

Closes-Bug: #1357433
Change-Id: I20ee7f9a6dbf047798b0cc954aa861f774e683b9
warn against sorting requirements

And do not check for sorted files.

Change-Id: I64ae9191863564e278a35d42ec9cd743a233028e
Closes-Bug: 1365061
Log translation hint for Heat.common

Currently, Log translation is motivated by oslo's move to prioritized
translation of strings, as documented at
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation

- add log translation hints for warning, error and info levels
- move from LOG.warning to LOG.warn
- remove use of % as a string formatter, use the log functionality
  instead

Partial implements blueprint log-translation-hints

Change-Id: I715f69154bd199dabac7d537b982b875204f8b33
Merge "Refactor nested stack create/update/preview"
Reuse disable_rollback on stack update

If disable_rollback API parameter is not supplied to stack update,
use corresponding value of existing stack.

Change-Id: Iad60e12d31dc3850071dc0b8562c7b99f53adba4
Closes-Bug: #1324366
Merge "Implement OS::Sahara::Cluster resource"
Only delete stack user project from correct domain

Check the domain ID for the project matches the configured domain from
heat.conf, so we avoid the bad outcome of deleting the user's project
when heat has been configured for stack domain users after creating
some stacks.

Change-Id: I247e732033f44daf0de5b0efeff6c263814d13ab
Closes-Bug: #1365332