Commit Graph

80 Commits (master)

Author SHA1 Message Date
Takashi Kajinami 23e647539c Remove six
This library no longer supports Python 2, thus usage of six can be
removed.

Change-Id: I8d0c1cfd6dff375b3b7756a5b36c95a2df3f04c6
1 year ago
Hervé Beraud 4408269ae3 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ifbca4f0b72663e026a92061c213e728cf755772c
3 years ago
Andreas Jaeger 9dede4eb2b Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I82c745f5b1236844deec4538be84037a64eebeee
3 years ago
Jenkins d7cb611e5c Merge "Trivial:remove unused code" 6 years ago
Jenkins d29567796b Merge "Make method import_versioned_module work" 6 years ago
Jason Dunsmore 2cd3db1111 Make sure the --heat-url option is respected, part 2
If the endpoint is passed in, make sure keystone uses it instead of
looking up the endpoint in the auth plugin.

Original fix: 9e28993ee6

Closes-Bug: #1654344
Change-Id: I4b42ab9d87c790eef1953f995260b6b232a63445
6 years ago
shizhihui f6ec0af054 Trivial:remove unused code
Change-Id: I8eac6869f0fe05ca348452e67d2b4855f11fbe60
7 years ago
shizhihui 8885ce7818 Make method import_versioned_module work
Oslo.utils 3.17 provides similar function, just use it.
For more information:
[1] http://docs.openstack.org/developer/oslo.utils/history.html

Closes-Bug: #1627313

Change-Id: Ie738e910cc72535fe97295d7e118eda2412ecd15
7 years ago
Chuck Short 29d6c613f6 Graduate to oslo.i18n and cleanup incubator usage
Graduate from Oslo Incubator to oslo.i18n library.
Cleanup of unused Oslo Incubator utils.
Added optional enable_lazy() usage.

Change-Id: I5ec02477f3f52f4d7097669120581e82cced3748
Signed-off-by: Chuck Short <chuck.short@canonical.com>
7 years ago
tamilhce f2147f79aa Don't use endpoint_override with session
We should not use endpoint_override by default and rather
use service_type with session. This also refactors some of
the associated code.

However, if one wants to override the endpoint they can pass
endpoint_override to the client constructor along with session.

Change-Id: I7c27d8ff827de3b4bb3e70457c0b6a3f47b6d7bb
Co-Authored-By: Rabi Mishra <ramishra@redhat.com>
Closes-Bug: #1621505
7 years ago
rabi 0e0959eb7c Remove redundant auth discovery
This removes the redundant auth discovery
and use generic auth plugins.

Change-Id: Ibf96a188363467e74879018e31c0d8729c6cdeee
7 years ago
Steve Martinelli 2d32a08a23 switch to keystoneauth
move heatclient to keystoneauth as keystoneclient's auth session,
plugins and adapter code has been deprecated [1].

[1] http://docs.openstack.org/releasenotes/python-keystoneclient/mitaka.html#deprecation-notes

Change-Id: Iedd7ceb97d39ab3ecccf8786aad8b5f45d15175e
7 years ago
cedric.brandily 17b4b16ace Support OS_KEY/OS_CERT environment variables
heatclient allows to provide client certificate/key using --os-key/cert
options but not using usual environment variables.

This change uses OS_KEY/OS_CERT environment variables as default values
for client certificate/key.

Closes-Bug: #1564930
Change-Id: Ie7a4dce2a9b0e498ee3b9f6cb36a8988ea3a13fc
7 years ago
Herman Ge 1e5b0f8fbf Misspelling in message
Misspelling in following message:

"# refactor this code once this functionality is avaible in"

Should be:

"# refactor this code once this functionality is available in"

Totally 1 occurrence in python-heatclient base code.

Change-Id: Icc6148125e63bbd16811dad77718267dc8092605
7 years ago
Steve Martinelli 7401335f85 use keystoneclient exceptions instead of oslo-incubator code
depending on any oslo-incubator code from another project is
dangerous. keystoneclient makes its exceptions public and it's
not recommended to use any code from
keystoneclient.openstack.common.apiclient since it's maintained
by oslo-incubator.

Change-Id: Id1f5d1ddc5b297c9547c6d16d3ee70496c7852f4
8 years ago
ricolin 978eeb3994 Enable pep8 E126 test
Enable E126 continuation line over-indented for hanging indent.

Change-Id: I12ca2d8d610574dfcd528b0e613ec0328f4fb45e
8 years ago
ricolin ec2530b975 Enable pep8 E128 test
Enable E128 continuation line under-indented for visual indent

Change-Id: If662f729e7aacdd439b38c5e5630d74afefebcc6
8 years ago
tengqm 284c1c5b8d Migrate to new oslo_xxx namespace
This patch migrates the namespace of oslo packages from oslo.foobar to
oslo_foobar.  The oslo_incubator code need to be resynced, which will be
submitted in another patch.

Change-Id: Id77207750556b71f20797a0ee6f2cafd62ea30e1
8 years ago
Adrien Vergé 4cda08d91c Fix non-working endpoint type argument
Whatever the endpoint type passed with --os-endpoint-type or
OS_ENDPOINT_TYPE, the publicURL is always used (instead of, for
instance, adminURL or internalURL).

This patch passes the user-defined endpoint type to keystoneclient's
get_endpoint() so that the correct endpoint is chosen from the catalog.

Change-Id: Iee9f0e576d5fba3b4bf1dd267dfee233b0a7ea8f
Closes-Bug: #1422487
8 years ago
Tetiana Lashchova 6ff27ccabf Add transtlation markers for error messages
Change-Id: Ic44073880b7e65b6530a7314a5a2d65eb4aadb09
Partial-Bug: #1269930
9 years ago
Tetiana Lashchova 4916c64f7f Add transtlation markers for help messages
Change-Id: I20a487952b8c4e4cc74a69e731e84672daff22e4
Partial-Bug: #1269930
9 years ago
Steven Hardy 9fffbd8709 Remove remaining deprecated oslo-incubator modules
Remove remaining reference to gettextutils and remove the module,
as it no longer exists in oslo-incubator.  Also remove timeutils
for the same reason, it's not referenced by any remaining code.

Closes-Bug: #1380629
Change-Id: Ie3ad3fe73fd5e73dd6ede0c375eb2077d95bda3f
9 years ago
Steven Hardy 0e93da5dee Convert importutils to oslo.utils
Change-Id: I58dfdc608bcddd0fce9df818033b2cb33eee3296
Partial-Bug: #1380629
9 years ago
Jenkins ebdc167198 Merge "Convert strutils to oslo.utils.encodeutils" 9 years ago
Tetiana Lashchova d0b0270ec7 Fix H302 errors
Change-Id: I0354b4c99fb6d22ede85ec711fb81c2bb3627f99
9 years ago
Steven Hardy 5259f00827 Convert strutils to oslo.utils.encodeutils
Convert the encode/decode functions from oslo-incubator to use
oslo.utils encodeutils, as the incubator functions are now
deprecated.

Also syncs oslo-incubator to 62394a3 to purge usage of strutils
from the openstack/common modules.

Note includes oslo fix https://review.openstack.org/#/c/133290/
which we need or the python3 tests won't pass.

Change-Id: I630fe3f3ce14ae745a8417bfe6552acd31341c9c
Partial-Bug: #1380629
9 years ago
Vijayaguru Guruchave 970d688eb2 Pass auth_url if os_no_client_auth specified
The standalone auth_password middleware expects 'X-Auth-Url' header
in the request. The recent version of heatclient doesn't pass the
required header which is retrieved from the option '--os-auth-url',
though we explicitly specify it in the commandline. Let's pass the
argument 'auth_url' and get heatclient working in standalone mode.

Change-Id: I3e67f4699c61c3ce5c42f25e3c8b137f8ba8a2e3
Closes-bug: #1380658
9 years ago
Angus Salkeld c0585eba4c Add support for OSprofiler
To be able to create profiling traces for Heat, the client should be
able to send special HTTP header that contains trace info.

Change-Id: I2ff833fac2dfe3bb0fcbd6a31c210db2935b72f1
Closes-bug: #1363782
9 years ago
Jenkins 95841b5633 Merge "handles keyboard interrupt" 9 years ago
Rakesh H S ec44d2a49e handles keyboard interrupt
When an user intentionally provides an keyboard interrupt, heatclient
throws the entire traceback on to the terminal instead of handling it.

heatclient will now handle the keyboard interrrupt and provides an crisp
message on to the terminal.

Change-Id: Iaa30048e7948d7db1d5b256dd59ca2e0dd842df9
Closes-Bug: #1367283
9 years ago
David Hu 9154f6dff8 Re-add keystone v3 auth with fixes
The first part of the commit is to re-propose the v3 auth changes.
https://review.openstack.org/#/c/92728/

The second part of the commit is to address the unexpected keyword
argument 'follow_redirect' and missing endpoint issue in certain
code path such as 'heat event-list' or 'heat resource-metadata'.
With the fix, follow_redirect argument is consumed by
SessionClient.  Heat endpoint is now passed from Heatclient
shell to SessionClient.

Unit tests were added and updated to cover the issue.

Change-Id: I0cdf837c924afe9cbd8826bdca5dd611c183efeb
Closes-Bug: #1349467
Closes-Bug: #1348297
9 years ago
Thomas Herve 42c5096770 Revert "Add keystone v3 auth support"
This reverts commit a98c1f3617.
The new usage of session doesn't work with resources or events.

Conflicts:
	heatclient/tests/test_shell.py
Closes-Bug: #1349467

Change-Id: Ib5b0db81454abe647aca6461dd7bd5f197267fb8
9 years ago
David Hu a98c1f3617 Add keystone v3 auth support
This change enables the heat client to use the keystone v3 API (in
addition to v2).  This allows user domains and tenant/project domains to
be specified.  This is necessary because keystone v2 API is deprecated
as of Icehouse.

Change-Id: Id19c4e52b12b379746a36b1f9fb61eb2825c78f3
9 years ago
Steve Baker dc5911e1a3 Improve --debug logging output
This change makes the following improvements to the output of a heat
command with the --debug option set:
* Silences spurious logging from iso8601 and urllib3.connectionpool
* Removes the line number from the logging format, since the intent
  of --debug is to show the user what network requests are occuring.

Change-Id: Iccbae01a1a5b85db0770a4f56c3b48788dc3008a
Closes-bug: #1324470
9 years ago
Rob Crittenden d32cdc0edc Heat client does not support OS_CACERT option
This option is standard in OpenStack clients to pass in the
location of any extra CA certificate bundle needed to
negotiate an SSL connection with SSL-secured services.

Change-Id: If675b36bf6bbd1df216277129b147c32555de0d0
Closes-Bug: 1308087
9 years ago
Steven Hardy d9e3b3d2cd 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
9 years ago
Steven Hardy 38098938be Rename --timeout global option and make it work
The --timeout option doesn't work for standalone use-cases when
you specify no-client-auth, and it's also confusing since it's
easily misinterpreted as an option related to the heat timeouts
provided to stack-create and in future stack-update.

So take this opportunity to rename the option to --api-timeout,
which hopefully more accurately reflects it's purpose, and don't
pass a default (just let requests use the global default socket
timeout) as it seems relatively unlikely users will wait for 10
minutes before pressing Ctrl-C on interactive shell requests.

Change-Id: I52480f0d128735bf5f312fc88f4078f27717baf2
Partial-Bug: #1290456
9 years ago
JUNJIE NAN aa30e4642a Enable --help for each command
Now heat stack-create --help outputs same with heat --help. It should
output the help message for stack-create instead of the global one.

Change-Id: I1b451ddb4ecba3bb3294ff3219a5ecad394ada9e
9 years ago
Andreas Jaeger c676536d95 Improve help strings
Follow oslo.config style guide for help strings better to create
consistent help strings:
* Finish help strings with "."
* Add missing spaces between words

Change-Id: I6191842c253b254768bcc5c22fcfb435296f3945
Co-Authored-By: Shilla Saebi<shilla.saebi@gmail.com>
9 years ago
Randall Burt 2fc9b4f5ea Configure logging regardless of debug flag
Configure the logging level for the client. Default to ERROR
unless -d is passed, then use DEBUG.

Closes-Bug: #1273800
Change-Id: Iea337bed55ca7da2fc95d0d3218a4895909423cd
9 years ago
Chmouel Boudjnah 1db0ac2d21 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
10 years ago
Chmouel Boudjnah 717ab9369d Remove ununsed httplib2 requirement
This is not needed anymore since the logging is handled by
six.moves/httplib.

Change-Id: I4315860648258fb760ea22ca09d0083d7c9afb6c
Closes-Bug: #1266584
10 years ago
anusha-rayani-7 9c232eaf76 Misc typos in Heat client
Closes-Bug: #1256000

Change-Id: I1f607dd2c0499c1824442542a17e17bef8a0f020
10 years ago
ZhiQiang Fan 992d6f5350 Supports bash_completion for heatclient
bash_completion feature can improve CLI user experience, projects like
nova, keystone, and cinder already support it.

NOTE: this patch just provides simple functionality, which means cache
for IDs and names is not used (like nova).

Closes-Bug: #1260939
Change-Id: I327e884e1c5907c9ff6f31131c70aee659cca58e
10 years ago
Steve Baker fd6e997930 Add back --token-only for invocation compatibility
This unused option should remain so that scripts that
use it do not break. It is suppressed so it will not
appear in the help.

Closes-Bug:1250731

Change-Id: I1180d8797d1e4c79dba92952931311cce50a1d3f
10 years ago
chenhaiq 6f3e0842e4 Add --include-pass option for grizzly backwards compat
Set X-Auth-User, X-Auth-Key on all stack commands to allow the
latest python-heatclient to work on grizzly heat.

Partial-Bug:1250731

Change-Id: I29d4785cf3520e809252b5aeab25cf471a88cde8
10 years ago
Jenkins b0b085dfb3 Merge "Honor endpoint_type when requesting keystone for a token" 10 years ago
Steven Hardy 2706b48159 Make tokens work with --os-no-client-auth
Currently --os-no-client-auth assumes you'll only ever want to pass
a username and password to the standalone auth_password middleware,
but it's also valid to pass a token and endpoint, which can then
be used to either connect to a normal (non-standalone) Heat without
needing the client to connect to keystone, or pass a token to custom
auth middleware in standalone mode where tokens are accepted.

e.g:

heat --os-no-client-auth
      --heat-url http://127.0.0.1:8004/v1/<tenant ID>
      --os-auth-token <a token> stack-list

Change-Id: Ie22c85ba5b3b987505f4d6204b4dd6ff03e0d912
Closes-Bug: #1252248
10 years ago
Steven Hardy fe3629f1ba Fix shell operation with --os-auth-token
Currently the --os-auth-token/env[OS_AUTH_TOKEN] case doesn't
work, as we always expect a username/password to create the
connection to keystone.  This enables the client to be used
with only a token and tenant (which is required for keystoneclient
to retrieve the catalog) specified, e.g:

heat --os-auth-url http://127.0.0.1:35357/v2.0/ \
     --os-auth-token <a keystone token> \
     --os-tenant-id <tenant ID> stack-list

Change-Id: I478ce178f44e42c68153f1b347c6144f0a133f5b
Partial-Bug: #1252248
10 years ago
Steven Hardy be6852bf32 Pass only tenant name or ID to keystoneclient
When creating the keystoneclient, we only need to pass the tenant
ID or name, not both

Change-Id: I0dd03759979026daba1be343f7194f9b7e15a589
10 years ago