Move template_format from heat to heatclient

heatclient needs to (YAML) parse the template to allow it to populate
the content for get_files function calls. For this reason, template_format
(and environment_format) have been moved to heatclient so this code can be
shared by both heat and heatclient.

Change-Id: I3cc11cd57256ad539efb4dab314ac07547e9e6a2
Fetch environment from fields rather than function arg

This is part of a refactoring of the environment code in preperation for
supporting the get_file intrinsic function.

Change-Id: I8bfc0e17822bb2fa66665241e8873cf7cf1ea611
Use template_format.parse for local stack parsing

Previously, API requests contained parsed templates for
json templates, but string content for YAML templates.

This change means that all requests will now contain parsed
templates. A parsed templates is required for get_file
client-side processing.

According to profiling that Clint performed, YAML parsing
could become a significant source of heat server load, so this
change will also mitigate this by pushing out YAML parsing
load to the clients.

This is part of a refactoring in preperation for
supporting the get_file intrinsic function.

Change-Id: Icca0f5e8ad197433872a995419648f841c9f82e0
reconcile prepare_environment_file/url into one funtion

This is part of a refactoring in preperation for
supporting the get_file intrinsic function.

Change-Id: I5c4a16d76fa29f7be2e4db737ebec49fdc1644e4
Move environment and template file functions to own module

This is part of a refactoring in preperation for
supporting the get_file intrinsic function.

Change-Id: If6974fc72c47e6a5c6545e65375e75cfd177fb7a
Test coverage of empty environment

Change-Id: Iade321762a0e68605006252204d0dd4c7aac8a39
Improve and unit-test template contents fetching

This includes some important changes in the way template
content is fetched:
* for template_file, the value is converted to a file:// URL and the
  actual fetching is performed with the URL fetching code path.
  As a consequence it is now possible to specify a file path *or*
  a URL for the --template-file command option. This is a change in
  behaviour, and it does make --template-url somewhat redundant.
  This makes the behaviour of --template-file consistent with the
  behaviour of --environment-file.
* for template_url, the content is fetched in heatclient so that
  the server does not need to fetch the template at all. This means
  that in the API request the 'template' field is populated instead
  of 'template_url'. We can consider deprecating 'template_url' from
  the REST API.

Change-Id: Id8de05973381dba7ac052c45dd074071fd3035b2
Copy run_test.sh from heat repo

This allows run_test.sh to run without a working venv, plus all the
other features of heat/run_test.sh

Change-Id: I71d7af8a5442626192c5c8b5dca446a999ff6ede
Remove dependencies on pep8, pyflakes and flake8

They should be determined by the hacking dependency
implicitely.

Change-Id: I137feb8f44349be1bfb810b93f1f10bbdaf150e2
Raise traceback on error when using CLI and -debug

When --debug is specified to the CLI don't just print the simple error
message but actually reraise that error.

Change-Id: I616eda8e033342cff7f3412e3a414a7530ef3848
Closes-Bug: #1268202
Merge "Move template_format from heat to heatclient"
Merge "Fetch environment from fields rather than function arg"
Merge "Use template_format.parse for local stack parsing"
Merge "reconcile prepare_environment_file/url into one funtion"
Merge "Raise traceback on error when using CLI and -debug"
Merge "Copy run_test.sh from heat repo"
Remove unused method 'string_to_bool' from utils

The method 'string_to_bool' in utils is not used.
Furthermore, if we need this method in the future,
we should use 'bool_from_string' from oslo cliutils
to replace it.

partially implements blueprint common-client-library-2

Change-Id: I21978d389a8721a40e1669351575297ce61a438e
Merge "Move environment and template file functions to own module"
Merge "Test coverage of empty environment"
Merge "Improve and unit-test template contents fetching"