13 Commits

Author SHA1 Message Date
John Trowbridge
c628427575 Increase command_timeout for openstackclient commands
We recently patched the openstackclient code to increase the number
of retries when running commands[1], but I think what we really wanted
was to increase the amount of time to wait on each retry.

The original approach did help somewhat, but it is doing so by just
racing more times. Instead, it would be better to win the race more
often.

This is mostly a CI or developer environment issue where we are
deploying with the minimal amount of computing resources to get
a functioning cloud.

[1] https://git.openstack.org/cgit/openstack/puppet-openstacklib/commit/?id=489099632446b1903986549e5feb80b509f9b77d

Change-Id: I0707165a9e8054c1b3e0ad299604356cecc9f99f
2016-07-25 12:16:29 -04:00
Sofer Athlan-Guyot
806f31d740 Add optional exceptions regex to avoid to retry.
This is useful when the user (a puppet provider) is expecting a error.
With this it doesn't have to wait for the long retry cycle to have its
error back.  This replace the awkward mechanism in
self.request_without_retry which was dynamically mangling
request_timeout and disabled even legit retry.

Examples of such function are self.fetch_user, self.fetch_project in the
keystone provider.

Change-Id: I589da0100ad3ccf3abf17ac8b26c827793ace484
Related-Bug: 1597357
2016-06-29 15:42:13 -04:00
Sofer Athlan-Guyot
4890996324 DEBUG: testing increase timeout for tripleo CI.
If that's working maybe do https://review.openstack.org/334011

Change-Id: Id428b112eeaa22ecef78a21032b0c1dcc0ac0592
2016-06-28 18:22:59 +02:00
Sofer Athlan-Guyot
fedb3152c9 Add the possibility to execute without retry.
It may be useful to be able to execute a command without a retry.

A good use case is provider in [1], where the keystone_user resource try
to get an user by fetching it.  It is expected to fail when the user is
absent.  With the current implementation, it will takes 60 seconds for
the provider to give up on the user.

[1] https://review.openstack.org/299301

Closes-Bug: #1563898

Change-Id: I5b334e3ffd26df4ba8584d77a5e41b56e73536c8
2016-04-13 14:06:03 +00:00
Matt Fischer
adb0b1d012 Log the correct command_timeout value
For the no-retry_actions we need to log the correct, longer, timeout.

Change-Id: I035c1eee84f0db5f04e3b63f8bb12a13738d4327
2016-03-31 10:20:13 -06:00
Matt Fischer
579ad2d370 Adjust timeout for non-retry calls
Give non-retry calls the full timeout seconds to finish and also
don't log that you're going to retry them when you are not.

Change-Id: I51cbe3905b55f035718245b45bfc34536b8ce602
2016-03-30 08:31:55 -06:00
Dmitry Ilyin
701b6fe0ac Add retries to the openstack command
Sometimes openstackclient can hang if Keystone
API fails to respond to requests.
This patch adds retries to work around these
situations.

* Retry and timeouts for openstack command
  -'command_timeout=20':
    after this timeout openstack command is retried
    untill the request_timeout.
    (The value of command_timeout parameter was updated
    from 10 to 20 as it was observed that "10" value is
    not enough when sytem was overloaded.)
  -'request_timeout=60':
    timeout of the entire request.
  -'retry_sleep=3':
    interval between command retries
* Does not retry non-idempotent actions.
* Improve specs

Change-Id: Ifd8ae1b00321366e3a54fd6fe4a68db46bb743c7
2015-12-21 16:34:50 +02:00
Michael Polenchuk
92b92aa4c9 Catch HTTP 403 response
Also catch not authorized requests with HTTP 403 response in order to
handle it further.

Change-Id: Ib922bd5892f0204566656303e6a484daa8d2d5e7
2015-11-30 20:11:33 +03:00
Gilles Dubreuil
67d1c38703 Restructures authentication for resource providers
Workflow to find credentials details from:
  1. The environment variables (ENV['OS_*'])
  2. If not enough, credentials available from the environment RC file
     to be used. Default RC file must be in current user homedir: ~/openrc

  - Adds module Puppet::Provider::Openstack::Auth providing class methods for
  providers instead of relying on superclass inheritance.
  As discussed [1], this purposefully removes the possibility to pass authenti-
  cation details as parameters to Puppet resources instances.

  - Wraps credentials information with object:
    Puppet::Provider::Openstack::Credentials

  - The credentials information is used in a withenv block

  Review for puppet-keystone needs to be merged at same time:
  https://review.openstack.org/#/c/181299/

  [1] http://lists.openstack.org/pipermail/openstack-dev/2015-May/063352.html

Change-Id: If628f4ad95f3aac3392475d4ea6857fb858f8755
Implements: blueprint auth-restructure
2015-05-28 09:44:54 +10:00
Gilles Dubreuil
54f3a0be5c Added openstack/OSC option os-identity-api-version
- Default to version 3

Change-Id: I53f6bdec003ca0ee770a9b91fc2a83eb30480efe
2015-04-27 16:53:36 +00:00
Gilles Dubreuil
d4073c2721 Targeting Keystone V3 API support
The default domain (id 'default', name 'Default') is where the V2
tenants/users are defined. So V3, which is now the default API's version
can and should be used.  Beeing able to use V3 domains needs to be
supported by specifying the domain name for a project/user.

This patch :
- Adds project and user domain names
- Renames tenant (v2) as project (v3)
- Renames os-auth-url to os-url, when using an authicated token against a
  service url, to distinct them from each other, as in OSC
(opentackclient)
- Updates newparam(:auth) accordingly to describe v2/v3 credential
  examples

Note: Keystone API v2 is deprecated [1]

[1] http://docs.openstack.org/developer/keystone/http-api.html#should-i-use-v2-0-or-v3

Change-Id: I72f79129a6875eb433eeb8a62f928e7210db134a
2015-04-03 13:17:25 +11:00
Clayton O'Neill
efa9181201 Properly handle embedded newlines in csv
When parsing the response from the OpenStack client values (like
keystone tenant descriptions) can have embedded newline. To avoid this
issue, we drop lines that don't start with a double quoted value until
the first one we find.

Change-Id: Ie952161b503d2c46637e6a6e1c83b2dfce1c03a7
2015-03-17 09:57:35 +00:00
Colleen Murphy
ed58789665 Move openstackclient parent provider to openstacklib
This patch abandons the use of the Aviator library for interacting with
the openstack APIs in favor of the universal openstack client[1]. This
work has already been implemented in the keystone module. This patch
moves that work into openstacklib in order to make it available for the
other modules.

[1] https://wiki.openstack.org/wiki/OpenStackClient

Change-Id: I68705c28955a54e26d98f1de718016691c64e4b1
2015-03-05 11:39:19 -08:00