28 Commits

Author SHA1 Message Date
Tobias Urdin
6c95216ffd Replace port 35357 with 5000
Change-Id: Idb029906fe32f42230e113ee71ec71c72712eee9
2018-07-18 10:26:06 +02:00
Sofer Athlan-Guyot
124daec7bb Making immutable config setting when using <_IMMUTABLE_>.
Similar to what is done with os_service_default, but here we have the
possibility to tell puppet to not change the existing value, whatever
this is.

The associated fact for syntactic sugar in the module is
`::os_immutable`.

Partial-Bug: #1763322
Change-Id: Iaea44309db9b1b075425fa15890ba592d8bc9b7e
2018-06-29 22:13:55 +02:00
Emilien Macchi
7df431c81e Implement os_workers_heat_engine
Re-using the classic os_workers fact but changing the minimum from 2 to
4, specific to the fact Heat Engine can be stressed out.
Also cap to 24 workers at maximum.

Change-Id: I31d02bea6dd55d65a7014503398adc4422ce7303
2017-12-22 22:31:56 +00:00
Alex Schultz
b5bd19a630 Switch to Facter.flush
Facter.clear clears all cached values and removes all facts from memory
where Facter.flush just clears the cached values. This should reduce the
time it takes to actually run the unit tests as it all the other facts
we're touching won't be removed from memory.

Also we only need to do it before the tests, not before and after.

Change-Id: I9a24dc9f74cb3b59508b12e63a078068c26c1442
2017-12-22 15:31:47 -07:00
Mathieu Gagné
e5005dc4ff Ensure os_workers_large fact returns an Integer
Also make sure it returns at least 1.

Closes-bug: #1738082
Change-Id: I6b48842862a6860215ff774f73ae7224a34545e7
2017-12-13 17:40:26 -05:00
Alex Schultz
61044892ad Ignore extra bash code from openrc
If a user has additional code in their openrc file that isn't just bash
variables, the auth provider might fail while parsing it. This change
updates the logic to only try and parse lines with OS_ in it to make
sure that extra things like bash code are ignored.

Change-Id: Id6f5406dcf15642bc0d70caeac30224114bb0669
Closes-Bug: #1699950
2017-06-23 08:48:10 -06:00
Clayton O'Neill
f705fd6f4d Add region support to credentials
This fixes the credentials classes to properly accept region as a
property to manage.  This allows OS_REGION_NAME to be set properly if
the child class passes it in.

Change-Id: I3345dac8bebd68f93290c1d45aa9a4d80bf3fb34
Partial-Bug: #1517220
2016-10-03 20:49:31 +00:00
Sofer Athlan-Guyot
2075930b90 Add a way for provider to transform value in config.
For instance this would enable this:

    neutron_l3_agent_config {
        'DEFAULT/router_id': value => $router_name, transform_to => 'uuid';
    }

The neutron_l3_agent_config would only have to implement this:

    def to_uuid(name)
      # code to get the uuid
    end

    def from_uuid(uuid)
      # code to return the name
    end

Change-Id: I3b7c17590b27cd3a22c5458342d049969ade2281
Co-Authored-By: Drew Fisher <drew.fisher@oracle.com>
2016-08-04 12:53:50 -07:00
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
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
Denis Egorenko
85d8296030 Set policy-rc.d file as executable
Policy-rc.d requires to be set with +x chmod.

Change-Id: I1bad3301729fa6310d9d1a50c22c621ffe44e24a
2016-06-21 18:56:19 +03:00
Denis Egorenko
2fc25c54ce Add release note for policy_rcd provider
Change Ic54b9707b6ef36032d71fe9dc04a7e310293f127 missed release note,
so this patch adds it.

Alos improve unit test for policy-rcd provider.

Change-Id: Ie6d4dd1e5406acd097969a9ff7fccd5dfa7f8632
2016-06-21 12:38:34 +03:00
Denis Egorenko
ec58851c44 Add provider for managing policy-rc.d
Use provider for managing policy-rc.d file to be sure that
services stopped right after package installed.

Also added tests.

Change-Id: Ic54b9707b6ef36032d71fe9dc04a7e310293f127
2016-06-20 21:36:50 +03:00
Jenkins
6cbf40bdc1 Merge "Add retries to the openstack command" 2015-12-23 10:07:18 +00: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
Jenkins
f84baa1f69 Merge "OpenStackConfig provider" 2015-12-10 17:56:58 +00: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
Martin Mágr
029c6a74cc OpenStackConfig provider
This patch add support for parsing configuration files of projects
which use oslo.config.cfg.MultiStrOpt (currently Neutron LBaaSv2).

For details see:
http://docs.openstack.org/developer/oslo.config/api/oslo.config.cfg.html#oslo.config.cfg.MultiStrOpt

Change-Id: If782aa4bf83712ac2a5f4d2f4e8ace782409182d
2015-11-04 16:06:04 +01:00
Michael Polenchuk
086c8806c0 Fallback to default rcfile
For missing HOME env variable set rcfile to /root/openrc by default.

Change-Id: Icd13f7ce46a999f3def18131042a83de574ffed8
2015-10-26 18:54:53 +03:00
Yanis Guenane
3b85306d04 Allow the use of an ensure_absent_val param
This commit aims to add a new feature for the ini_setting provider, this
feature aims to simulate the ensure => absent behavior when a specific
keyword is specified.

Currently a pattern we have is

if $myvar {
  keystone_config { 'SECTION/setting' : value => $myvar }
} else {
  keystone_config { 'SECTION/setting' : ensure => absent }
}

If one has dozens or hundreds of parameters to handle then it can easily
make the manifest hard to read.

The solution offer here would turn the above example in something like

Keystone_config {
  ensure_absent_val = '<SERVICE DEFAULT>' # It is the default
}

keystone_config { 'SECTION/setting' : value => $myvar }

If `$myvar` is '<SERVICE DEFAULT>' then it will act as if `ensure => absent` would
have been specified.

Also added new tests for openstack_config provider

Co-Authored-By: Denis Egorenko <degorenko@mirantis.com>

Change-Id: I0eeebde3aac2662cc7e69bfad7f8d2481463a218
2015-08-18 09:46:19 +02:00
Gilles Dubreuil
61da0090d8 Credentials#unset method
* Unset was broken, not resetting the variables
* Also added a rspec example

It worked but wasn't clean as if an authentication method failed some fields
could have been left un-blanked, creating bad side effects.

In addition:
* Added tests for #set with both valid and invalid values
* Added negative tests for #service_token_set? and user_password_set?
* Added test for #version
* Fixed #unset test
* Fixed #to_env test
* In several tests, added an OS_NOT_VALID parameter to make sure the
  credentials code correctly ignores it
* Added tests to make sure the fallback in Auth.request works properly
* Added additional tests to make sure the @credentials object is set
  correctly
* Fixed some formatting/alignment issues

Change-Id: I64cb492dc244b975827d2d0d86b4b97d7129088f
2015-06-24 16:51:07 -06:00
Rich Megginson
8441feb39d support for Keystone v3 authentication
This adds the class Puppet::Provider::Openstack::CredentialsV3
that implements support for Keystone v3 authentication and all
of the new id and domain authentication parameters.

Implements: blueprint api-v3-support

Change-Id: Icafc4cb8ed000fd9d3ed6ffde2afe1a1250d90af
2015-06-10 04:17:14 +00: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
Colleen Murphy
612fa7e121 Implement base aviator provider
This patch adds a dependency on the aimonb/aviator module and adds
functionality to support interactions with the OpenStack services' API
via aviator.

The patch adds a parent provider that is intended for other providers
to inherit from. The parent provider has methods to authenticate to
openstack services, create session objects, and make requests. The
authenticate method can accept credentials as an argument hash or infer
credentials from the environment.

It also adds a stub type parameter that allows types to incorporate
basic parameters they need in order to support using aviator.

Change-Id: I56b0d07ae8f4738037eda486b75a0f6e24fe80e7
Implements: blueprint use-aviator-in-module-resources
2014-09-30 21:01:28 -07:00