Move API parameter parsing from engine to API

API parameter parsing should be done in the API rather than the engine.

Change-Id: I133f419bbb73964b461572d8cadd300233af9c12
Refactor boolean conversion into a separate function

A method to convert API parameters to boolean values will be useful for
parsing the show_deleted API parameter, so create a separate function
named extract_bool.

blueprint stack-list-soft-deleted

Change-Id: I1bce5516b0a8c97d6c08607922968454d94b4406
Use resource methods for metadata get/set

The current approach of using the Metadata descriptor
class has some issues including:
* Unintended database queries on accessing a metadata attribute
* get/modify/set patterns since the attribute isn't backed by a real dict
* lack of control over whether to fetch metadata locally or from the db

This change creates Resource methods metadata_get and metadata_set to use
for reading and modifying resource data. This is a refactoring change only so
there should be no change in behaviour.

This change will help in the future with
Related-Bug: #1306743

Change-Id: I7cd87a071ac410a388d787f132c9aee194030714
Do not query database for every metadata_get

This change stores the rsrc_metadata locally when the Resource object
is created so that the database is not queried every time
metadata_get is called. There are some instances where the metadata
must come from the database (eg, polling for waitcondition signal) so
an optional refresh arg is added to metadata_get to force a database
refresh of the stored rsrc_metadata.

This results in one less sql query for every time metadata_get is called,
which will help the optimising effort for
Related-Bug: #1306743

Change-Id: Iad2d810c299347ae3b6a4a8329bbd314ee4b5c16
Refactor DB resource fetching from Resource to Stack

By moving this database call to the stack, this allows a future
change to adopt a loading strategy which avoids one sql call
per resource.

Change-Id: Ie29edaf3ffc0a332db421ad01edfa7445eb806e5
Don't use SSH in Rackspace::Cloud::Server

Rackspace Cloud Servers now supports config drive and the Rackspace
images have cloud-init installed by default, so we no longer have to SSH
to the Cloud Server to install dependencies and run the user-data
script.

Closes-Bug: #1298050
Change-Id: I5cb6a93c5b34b0a8cfe7480211da70d65638de54
Revert "Support ... x-forwarded-for header"

This reverts commit e3679217d1d4b1821f4fa0bd9894b761edfe4ba9.

This commit broke using the heat API when client requests were
behind a proxy (this sets the X-Forwarded-For header)
and effectively causes the heat-api to return the clients
IP address back in the request via the location header.

I believe the original (unapproved) heat blueprint for
this feature should have used X-Forwarded-Host instead.

Closes-bug: #1316754

Change-Id: I1b38ececf59545a3c13c7ebf2c33be97f4332ac0
resource-list fails on a failed resourcegroup stack

resource-list was failing if the stack fails when the ResourceGroup
resource is still in 'INIT_COMPLETE' status.
This change adds a check to make sure that nested stack is not None.

Change-Id: I7cbd5159fb544bda7c38b959c2b1b037bfaa4349
Closes-Bug: #1316705
Merge "Use resource methods for metadata get/set"
Merge "Do not query database for every metadata_get"
Merge "Refactor DB resource fetching from Resource to Stack"
Use keypairs.get instead of keypairs.list()

We can get(key_name) instead of listing the keypairs and
finding the correct one. Let's be more efficient!

Change-Id: Ie874d19581d6a090adf6b71dc0915232ee350fa5
Fixes-bug: #1278186
Merge "Don't use SSH in Rackspace::Cloud::Server"
Merge "Use keypairs.get instead of keypairs.list()"
Merge "Revert "Support ... x-forwarded-for header""
Merge "Move API parameter parsing from engine to API"
Merge "Refactor boolean conversion into a separate function"
Merge "resource-list fails on a failed resourcegroup stack"