Sort requirement files in alphabetical order

This makes code more readable, and can check whether specific library
in the requirement files easily. We also enforce the check in pep8.

Change-Id: I08434dd56d41a82045e4119e547b7b3f60d66698
Closes-Bug: #1285478
Pass bytes to NamedTemporaryFile.write()

In Python 3, this function takes bytes as an input.

Change-Id: I45faa50c4796605885489c9003a1b23b0f0b3080
Python3: fix test_stack_list_with_args()

The expected_url in test_stack_list_with_args() does not always match the URL
actually used in the code. This patch fixes this issue by:
- using urlutils.urlencode() in both the code and the tests, so that changes in
 the urlencode() implementation do not affect the tests;
- setting the PYTHONHASHSEED environment variable to 0 when running the tests,
  so that randomisation is disabled and urlutils.urlencode() has predictable
  results.

Change-Id: I5b50bad98f5c237cdc12e4ab75f21917ca0ef30d
Remove unused versions define in template_format.py

Remove unused 'HEAT_VERSIONS' and 'CFN_VERSIONS' define in
template_format.py.

Change-Id: I32202662ff62bc3e57b3af73b4163d2378887901
Deprecate create/adopt --create-timeout in favor of --timeout

Replace the --create-timeout option with a more generic and intuitive
--timeout option, which can also later be used for update.

Since users may be using this option and it does currently work, leave
the old -c/--create-timeout option for now, but mark deprecated in the
usage and output a warning message if users use it.  To make this
warning visible the default loglevel is changed to WARNING.

Note neither timeout contains an integer default now, we rely on the
server-side default (which is 60mins anyway) as this make the fallback
to support the previous option easier and potentially to provide an
easier way to solve heat bug #1290603.

Partial-Bug: #1290456
Related-Bug: #1290603
Change-Id: Ia8c8d61b259ffa1f8a59d29a3e7fa7d9c128984f
Add timeout option to stack-update

The API spec says the PUT which handles stack-update accepts a
timeout_mins argument, so add CLI support for it, making the
interface consistent with create/adopt.  Note this argument
currently isn't respected by heat, ref bug #1290603

Change-Id: Ie8d51540d0d93be51966e60601fd02d635cdae09
Closes-Bug: #1290456
Related-Bug: #1290603
Modify stack ID lookup to only use stacks:lookup

Currently when we lookup a stack ID (fully qualified name/id) via
stacks:lookup, we also follow the redirect to stacks:show, which
is not allowed for stack users.  We don't actually need to follow
the redirect, as we already have the required ID, so instead we
return the redirect response, so we can just allow all users to
do stacks:lookup in the policy.

This is useful for clients who want to call API actions which are
allowed for stack users, e.g resource:signal without having to know
both the name and ID of the stack.

Change-Id: I6f079cbc7ac3c680f15941668b4efbe4c3c5d60d
Partial-Bug: #1291097
Merge "Remove unused versions define in template_format.py"
Add new tests to cover most of the requests port

After the merge to requests there was a few tests to be added to
properly cover the port and now reach 97% for coverage of
heatclient/common/http.

Change-Id: I8282459718968337f1bcd650d540509c418020c5
Oslo: sync strutils

The strutils module has been improved with regards to Python 3
compatibility.  For instance, safe_{encode,decode} may now take bytes
as input, which is needed to completely port heatclient to Python 3.

This module is now in sync with commit
c1f1a6d87d3f8a5420f5e749ae5ed85e15ff5fe4.

Change-Id: I658467dc85038da029e0ae8b40fc027cdc4d5eaf
Merge "Python3: fix test_stack_list_with_args()"
Python 3: Fix YamlEnvironmentTest tests

In Python 3, this happens:

>>> 'foo' in ValueError('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument of type 'ValueError' is not iterable

We have to cast the Exception to make the tests work.

Change-Id: Ifc06c9860412030dc697b264812a6bf78e10eb8b
Remove dependent module py3kcompat

Module py3kcompat was removed from oslo-incubator, we can use
six directly.

* Sync commit of removing py3kcompat from oslo
* use six replace usage of py3kcompat

Change-Id: If0f9397588b2180fe198e804cbbb5b5c8420fe76
Closes-Bug: #1280033
Workaround failing pypy gate job

Until a proper fix is found, pin the version of setuptools to one
that doesn't cause this issue.

Change-Id: I4f5f2b6449a90df06b366f9eb3f2c16bb37cc758
Related-Bug: #1290562
Add stack-preview support

Co-Authored-By: Richard Lee <rblee88@gmail.com>
Change-Id: I4d7b12f6da09411d45dd6022dc11b8ece76b4932
Implements: blueprint preview-stack
Output warnings for deprecated commands

There are various options which have been deprecated for a long
time but with no user-visble indication of the deprecated status.
So log a warning to encourage the user to switch to the new
interfaces instead of just having a strongly-worded docstring ;)

Hopefully this means we can, at some future point, justifiably
remove the duplicate deprecated functions.

Change-Id: Ia5d791de99e7238645beb7d7650d811225d9d9c6
Merge "Oslo: sync strutils"
Merge "Add stack-preview support"
Merge "Modify stack ID lookup to only use stacks:lookup"
Merge "Remove dependent module py3kcompat"