Initial cookiecutter run and import from puppet-nova
Change-Id: I755606d45151235b03eaa315a3b55fefd6d1ee33
This commit is contained in:
parent
4680e7e936
commit
d51cdf664a
6
.zuul.yaml
Normal file
6
.zuul.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
- project:
|
||||
templates:
|
||||
- puppet-openstack-check-jobs
|
||||
- puppet-openstack-module-unit-jobs
|
||||
- puppet-openstack-integration-jobs-all
|
||||
- puppet-openstack-beaker-jobs
|
21
Gemfile
Normal file
21
Gemfile
Normal file
@ -0,0 +1,21 @@
|
||||
source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||
|
||||
group :development, :test, :system_tests do
|
||||
gem 'puppet-openstack_spec_helper',
|
||||
:git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
|
||||
:require => false
|
||||
end
|
||||
|
||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
||||
gem 'facter', facterversion, :require => false
|
||||
else
|
||||
gem 'facter', :require => false
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
gem 'puppet', puppetversion, :require => false
|
||||
else
|
||||
gem 'puppet', :require => false
|
||||
end
|
||||
|
||||
# vim:ft=ruby
|
176
LICENSE
Normal file
176
LICENSE
Normal file
@ -0,0 +1,176 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
82
README.md
Normal file
82
README.md
Normal file
@ -0,0 +1,82 @@
|
||||
Team and repository tags
|
||||
========================
|
||||
|
||||
[![Team and repository tags](https://governance.openstack.org/tc/badges/placement.svg)](https://governance.openstack.org/tc/reference/tags/index.html)
|
||||
|
||||
<!-- Change things from this point on -->
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
1. [Overview - What is the placement module?](#overview)
|
||||
2. [Module Description - What does the module do?](#module-description)
|
||||
3. [Setup - The basics of getting started with placement](#setup)
|
||||
4. [Implementation - An under-the-hood peek at what the module is doing](#implementation)
|
||||
5. [Limitations - OS compatibility, etc.](#limitations)
|
||||
6. [Development - Guide for contributing to the module](#development)
|
||||
7. [Contributors - Those with commits](#contributors)
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
The placement module is a part of [OpenStack](https://www.openstack.org), an effort by the OpenStack infrastructure team to provide continuous integration testing and code review for OpenStack and OpenStack community projects not part of the core software. The module its self is used to flexibly configure and manage the FIXME service for OpenStack.
|
||||
|
||||
Module Description
|
||||
------------------
|
||||
|
||||
The placement module is a thorough attempt to make Puppet capable of managing the entirety of placement. This includes manifests to provision region specific endpoint and database connections. Types are shipped as part of the placement module to assist in manipulation of configuration files.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
**What the placement module affects**
|
||||
|
||||
* [Placement](https://wiki.openstack.org/wiki/Placement), the FIXME service for OpenStack.
|
||||
|
||||
### Installing placement
|
||||
|
||||
placement is not currently in Puppet Forge, but is anticipated to be added soon. Once that happens, you'll be able to install placement with:
|
||||
puppet module install openstack/placement
|
||||
|
||||
### Beginning with placement
|
||||
|
||||
To utilize the placement module's functionality you will need to declare multiple resources.
|
||||
|
||||
Implementation
|
||||
--------------
|
||||
|
||||
### placement
|
||||
|
||||
placement is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.
|
||||
|
||||
Limitations
|
||||
------------
|
||||
|
||||
* All the placement types use the CLI tools and so need to be ran on the placement node.
|
||||
|
||||
Beaker-Rspec
|
||||
------------
|
||||
|
||||
This module has beaker-rspec tests
|
||||
|
||||
To run the tests on the default vagrant node:
|
||||
|
||||
```shell
|
||||
bundle install
|
||||
bundle exec rake acceptance
|
||||
```
|
||||
|
||||
For more information on writing and running beaker-rspec tests visit the documentation:
|
||||
|
||||
* https://github.com/puppetlabs/beaker-rspec/blob/master/README.md
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
Developer documentation for the entire puppet-openstack project.
|
||||
|
||||
* https://docs.openstack.org/puppet-openstack-guide/latest/
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* https://github.com/openstack/puppet-placement/graphs/contributors
|
3
bindep.txt
Normal file
3
bindep.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# This is a cross-platform list tracking distribution packages needed by tests;
|
||||
# see http://docs.openstack.org/infra/bindep/ for additional information.
|
||||
puppet [build]
|
6
doc/requirements.txt
Normal file
6
doc/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# This is required for the docs build jobs
|
||||
sphinx # BSD
|
||||
openstackdocstheme # Apache-2.0
|
||||
|
||||
# This is required for the releasenotes build jobs
|
||||
reno # Apache-2.0
|
10
lib/puppet/provider/placement_config/ini_setting.rb
Normal file
10
lib/puppet/provider/placement_config/ini_setting.rb
Normal file
@ -0,0 +1,10 @@
|
||||
Puppet::Type.type(:placement_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def self.file_path
|
||||
'/etc/placement/placement.conf'
|
||||
end
|
||||
|
||||
end
|
53
lib/puppet/type/placement_config.rb
Normal file
53
lib/puppet/type/placement_config.rb
Normal file
@ -0,0 +1,53 @@
|
||||
Puppet::Type.newtype(:placement_config) do
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'Section/setting name to manage from placement.conf'
|
||||
newvalues(/\S+\/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:value) do
|
||||
desc 'The value of the setting to be defined.'
|
||||
munge do |value|
|
||||
value = value.to_s.strip
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
return '[old secret redacted]'
|
||||
else
|
||||
return currentvalue
|
||||
end
|
||||
end
|
||||
|
||||
def should_to_s( newvalue )
|
||||
if resource.secret?
|
||||
return '[new secret redacted]'
|
||||
else
|
||||
return newvalue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:secret, :boolean => true) do
|
||||
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
|
||||
|
||||
newvalues(:true, :false)
|
||||
|
||||
defaultto false
|
||||
end
|
||||
|
||||
newparam(:ensure_absent_val) do
|
||||
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'placement'
|
||||
end
|
||||
|
||||
end
|
77
manifests/config.pp
Normal file
77
manifests/config.pp
Normal file
@ -0,0 +1,77 @@
|
||||
# == Class: placement::config
|
||||
#
|
||||
# This class is used to manage arbitrary placement configurations.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (required) Password for connecting to Nova Placement API service in
|
||||
# admin context through the OpenStack Identity service.
|
||||
#
|
||||
# [*auth_type*]
|
||||
# Name of the auth type to load (string value)
|
||||
# Defaults to 'password'
|
||||
#
|
||||
# [*project_name*]
|
||||
# (optional) Project name for connecting to Nova Placement API service in
|
||||
# admin context through the OpenStack Identity service.
|
||||
# Defaults to 'services'
|
||||
#
|
||||
# [*project_domain_name*]
|
||||
# (optional) Project Domain name for connecting to Nova Placement API service in
|
||||
# admin context through the OpenStack Identity service.
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*user_domain_name*]
|
||||
# (optional) User Domain name for connecting to Nova Placement API service in
|
||||
# admin context through the OpenStack Identity service.
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*region_name*]
|
||||
# (optional) Region name for connecting to Nova Placement API service in admin context
|
||||
# through the OpenStack Identity service.
|
||||
# Defaults to 'RegionOne'
|
||||
#
|
||||
# [*valid_interfaces*]
|
||||
# (optional) Interface names used for getting the keystone endpoint for
|
||||
# the placement API. Comma separated if multiple.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*username*]
|
||||
# (optional) Username for connecting to Nova Placement API service in admin context
|
||||
# through the OpenStack Identity service.
|
||||
# Defaults to 'placement'
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (optional) Points to the OpenStack Identity server IP and port.
|
||||
# This is the Identity (keystone) admin API server IP and port value,
|
||||
# and not the Identity service API IP and port.
|
||||
# Defaults to 'http://127.0.0.1:5000/v3'
|
||||
#
|
||||
class placement::config(
|
||||
$password = false,
|
||||
$auth_type = 'password',
|
||||
$auth_url = 'http://127.0.0.1:5000/v3',
|
||||
$region_name = 'RegionOne',
|
||||
$valid_interfaces = $::os_service_default,
|
||||
$project_domain_name = 'Default',
|
||||
$project_name = 'services',
|
||||
$user_domain_name = 'Default',
|
||||
$username = 'placement',
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
placement_config {
|
||||
'placement/auth_type': value => $auth_type;
|
||||
'placement/auth_url': value => $auth_url;
|
||||
'placement/password': value => $password, secret => true;
|
||||
'placement/project_domain_name': value => $project_domain_name;
|
||||
'placement/project_name': value => $project_name;
|
||||
'placement/user_domain_name': value => $user_domain_name;
|
||||
'placement/username': value => $username;
|
||||
'placement/region_name': value => $region_name;
|
||||
'placement/valid_interfaces': value => $valid_interfaces;
|
||||
}
|
||||
|
||||
}
|
25
manifests/db.pp
Normal file
25
manifests/db.pp
Normal file
@ -0,0 +1,25 @@
|
||||
# == Class: placement::db
|
||||
#
|
||||
# Configure the placement database
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*database_connection*]
|
||||
# (Optional) Url used to connect to database.
|
||||
# Defaults to 'sqlite:////var/lib/placement/placement.sqlite'.
|
||||
#
|
||||
class placement::db (
|
||||
$database_connection = 'sqlite:////var/lib/placement/placement.sqlite',
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
include ::placement::config
|
||||
|
||||
validate_re($database_connection,
|
||||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||
|
||||
placement_config {
|
||||
'placement_database/connection': value => $database_connection;
|
||||
}
|
||||
|
||||
}
|
73
manifests/db/mysql.pp
Normal file
73
manifests/db/mysql.pp
Normal file
@ -0,0 +1,73 @@
|
||||
# The placement::db::mysql class implements mysql backend for placement
|
||||
#
|
||||
# This class can be used to create tables, users and grant
|
||||
# privilege for a mysql placement database.
|
||||
#
|
||||
# == parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to connect to the database.
|
||||
#
|
||||
# [*dbname*]
|
||||
# (Optional) Name of the database.
|
||||
# Defaults to 'placement'.
|
||||
#
|
||||
# [*user*]
|
||||
# (Optional) User to connect to the database.
|
||||
# Defaults to 'placement'.
|
||||
#
|
||||
# [*host*]
|
||||
# (Optional) The default source host user is allowed to connect from.
|
||||
# Defaults to '127.0.0.1'
|
||||
#
|
||||
# [*allowed_hosts*]
|
||||
# (Optional) Other hosts the user is allowed to connect from.
|
||||
# Defaults to 'undef'.
|
||||
#
|
||||
# [*charset*]
|
||||
# (Optional) The database charset.
|
||||
# Defaults to 'utf8'
|
||||
#
|
||||
# [*collate*]
|
||||
# (Optional) The database collate.
|
||||
# Only used with mysql modules >= 2.2.
|
||||
# Defaults to 'utf8_general_ci'
|
||||
#
|
||||
# == Dependencies
|
||||
# Class['mysql::server']
|
||||
#
|
||||
# == Examples
|
||||
#
|
||||
# == Authors
|
||||
#
|
||||
# == Copyright
|
||||
#
|
||||
class placement::db::mysql(
|
||||
$password,
|
||||
$dbname = 'placement',
|
||||
$user = 'placement',
|
||||
$host = '127.0.0.1',
|
||||
$charset = 'utf8',
|
||||
$collate = 'utf8_general_ci',
|
||||
$allowed_hosts = undef
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
::openstacklib::db::mysql { 'placement':
|
||||
user => $user,
|
||||
password_hash => mysql_password($password),
|
||||
dbname => $dbname,
|
||||
host => $host,
|
||||
charset => $charset,
|
||||
collate => $collate,
|
||||
allowed_hosts => $allowed_hosts,
|
||||
}
|
||||
|
||||
Anchor['placement::db::begin']
|
||||
~> Class['placement::db::mysql']
|
||||
~> Anchor['placement::db::end']
|
||||
|
||||
}
|
59
manifests/db/postgresql.pp
Normal file
59
manifests/db/postgresql.pp
Normal file
@ -0,0 +1,59 @@
|
||||
# == Class: placement::db::postgresql
|
||||
#
|
||||
# Class that configures postgresql for placement
|
||||
# Requires the Puppetlabs postgresql module.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to connect to the database.
|
||||
#
|
||||
# [*dbname*]
|
||||
# (Optional) Name of the database.
|
||||
# Defaults to 'placement'.
|
||||
#
|
||||
# [*user*]
|
||||
# (Optional) User to connect to the database.
|
||||
# Defaults to 'placement'.
|
||||
#
|
||||
# [*encoding*]
|
||||
# (Optional) The charset to use for the database.
|
||||
# Default to undef.
|
||||
#
|
||||
# [*privileges*]
|
||||
# (Optional) Privileges given to the database user.
|
||||
# Default to 'ALL'
|
||||
#
|
||||
# == Dependencies
|
||||
#
|
||||
# == Examples
|
||||
#
|
||||
# == Authors
|
||||
#
|
||||
# == Copyright
|
||||
#
|
||||
class placement::db::postgresql(
|
||||
$password,
|
||||
$dbname = 'placement',
|
||||
$user = 'placement',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
Class['placement::db::postgresql'] -> Service<| title == 'placement' |>
|
||||
|
||||
::openstacklib::db::postgresql { 'placement':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
dbname => $dbname,
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
Anchor['placement::db::begin']
|
||||
~> Class['placement::db::postgresql']
|
||||
~> Anchor['placement::db::end']
|
||||
|
||||
}
|
25
manifests/db/sync.pp
Normal file
25
manifests/db/sync.pp
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Class to execute placement-manage db sync
|
||||
#
|
||||
class placement::db::sync {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
exec { 'placement-manage-db-sync':
|
||||
command => "placement-manage db sync",
|
||||
path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||
user => 'placement',
|
||||
refreshonly => true,
|
||||
try_sleep => 5,
|
||||
tries => 10,
|
||||
logoutput => on_failure,
|
||||
subscribe => [
|
||||
Anchor['placement::install::end'],
|
||||
Anchor['placement::config::end'],
|
||||
Anchor['placement::db::end'],
|
||||
Anchor['placement::dbsync::begin']
|
||||
],
|
||||
notify => Anchor['placement::dbsync::end'],
|
||||
tag => ['placement-exec', 'openstack-db']
|
||||
}
|
||||
}
|
40
manifests/deps.pp
Normal file
40
manifests/deps.pp
Normal file
@ -0,0 +1,40 @@
|
||||
# == Class: placement::deps
|
||||
#
|
||||
# placement anchors and dependency management
|
||||
#
|
||||
class placement::deps {
|
||||
# Setup anchors for install, config and service phases of the module. These
|
||||
# anchors allow external modules to hook the begin and end of any of these
|
||||
# phases. Package or service management can also be replaced by ensuring the
|
||||
# package is absent or turning off service management and having the
|
||||
# replacement depend on the appropriate anchors. When applicable, end tags
|
||||
# should be notified so that subscribers can determine if installation,
|
||||
# config or service state changed and act on that if needed.
|
||||
anchor { 'placement::install::begin': }
|
||||
-> Package<| tag == 'placement-package'|>
|
||||
~> anchor { 'placement::install::end': }
|
||||
-> anchor { 'placement::config::begin': }
|
||||
-> Placement_config<||>
|
||||
~> anchor { 'placement::config::end': }
|
||||
-> anchor { 'placement::db::begin': }
|
||||
-> anchor { 'placement::db::end': }
|
||||
~> anchor { 'placement::dbsync::begin': }
|
||||
-> anchor { 'placement::dbsync::end': }
|
||||
~> anchor { 'placement::service::begin': }
|
||||
~> Service<| tag == 'placement-service' |>
|
||||
~> anchor { 'placement::service::end': }
|
||||
|
||||
# all db settings should be applied and all packages should be installed
|
||||
# before dbsync starts
|
||||
Oslo::Db<||> -> Anchor['placement::dbsync::begin']
|
||||
|
||||
# policy config should occur in the config block also.
|
||||
Anchor['placement::config::begin']
|
||||
-> Openstacklib::Policy::Base<||>
|
||||
~> Anchor['placement::config::end']
|
||||
|
||||
# Installation or config changes will always restart services.
|
||||
Anchor['placement::install::end'] ~> Anchor['placement::service::begin']
|
||||
Anchor['placement::config::end'] ~> Anchor['placement::service::begin']
|
||||
|
||||
}
|
75
manifests/generic_service.pp
Normal file
75
manifests/generic_service.pp
Normal file
@ -0,0 +1,75 @@
|
||||
# == Define: placement::generic_service
|
||||
#
|
||||
# This defined type implements basic placement services.
|
||||
# It is introduced to attempt to consolidate
|
||||
# common code.
|
||||
#
|
||||
# It also allows users to specify ad-hoc services
|
||||
# as needed
|
||||
#
|
||||
# This define creates a service resource with title placement-${name} and
|
||||
# conditionally creates a package resource with title placement-${name}
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*package_name*]
|
||||
# (mandatory) The package name (for the generic_service)
|
||||
#
|
||||
# [*service_name*]
|
||||
# (mandatory) The service name (for the generic_service)
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Define if the service must be enabled or not
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Manage or not the service (if a service_name is provided).
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) Control the ensure parameter for the package resource.
|
||||
# Defaults to 'present'.
|
||||
#
|
||||
define placement::generic_service(
|
||||
$package_name,
|
||||
$service_name,
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present'
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
include ::placement::params
|
||||
|
||||
$placement_title = "placement-${name}"
|
||||
|
||||
# I need to mark that ths package should be
|
||||
# installed before placement_config
|
||||
if ($package_name) {
|
||||
if !defined(Package[$placement_title]) and !defined(Package[$package_name]) {
|
||||
package { $placement_title:
|
||||
ensure => $ensure_package,
|
||||
name => $package_name,
|
||||
tag => ['openstack', 'placement-package'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $service_name {
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { $placement_title:
|
||||
ensure => $service_ensure,
|
||||
name => $service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
tag => 'placement-service',
|
||||
}
|
||||
}
|
||||
}
|
40
manifests/init.pp
Normal file
40
manifests/init.pp
Normal file
@ -0,0 +1,40 @@
|
||||
# == Class: placement
|
||||
#
|
||||
# Full description of class placement here.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of nova packages
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*sync_db*]
|
||||
# (Optional) Run db sync on the node.
|
||||
# Defaults to true
|
||||
|
||||
class placement(
|
||||
$ensure_package = 'present',
|
||||
$sync_db = true,
|
||||
|
||||
) inherits placement::params {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
if $sync_db {
|
||||
include ::placement::db::sync
|
||||
}
|
||||
|
||||
package { 'python-placement':
|
||||
ensure => $ensure_package,
|
||||
name => $::placement::params::python_package_name,
|
||||
tag => ['openstack', 'placement-package'],
|
||||
}
|
||||
|
||||
package { 'placement-common':
|
||||
ensure => $ensure_package,
|
||||
name => $::placement::params::common_package_name,
|
||||
require => Package['python-placement'],
|
||||
tag => ['openstack', 'placement-package'],
|
||||
}
|
||||
|
||||
}
|
101
manifests/keystone/auth.pp
Normal file
101
manifests/keystone/auth.pp
Normal file
@ -0,0 +1,101 @@
|
||||
# == Class: placement::keystone::auth
|
||||
#
|
||||
# Configures placement user, service and endpoint in Keystone.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (required) Password for placement user.
|
||||
#
|
||||
# [*ensure*]
|
||||
# (optional) Ensure state of keystone service identity. Defaults to 'present'.
|
||||
#
|
||||
# [*auth_name*]
|
||||
# Username for placement service. Defaults to 'placement'.
|
||||
#
|
||||
# [*email*]
|
||||
# Email for placement user. Defaults to 'placement@localhost'.
|
||||
#
|
||||
# [*tenant*]
|
||||
# Tenant for placement user. Defaults to 'services'.
|
||||
#
|
||||
# [*configure_endpoint*]
|
||||
# Should placement endpoint be configured? Defaults to 'true'.
|
||||
#
|
||||
# [*configure_user*]
|
||||
# (Optional) Should the service user be configured?
|
||||
# Defaults to 'true'.
|
||||
#
|
||||
# [*configure_user_role*]
|
||||
# (Optional) Should the admin role be configured for the service user?
|
||||
# Defaults to 'true'.
|
||||
#
|
||||
# [*service_type*]
|
||||
# Type of service. Defaults to 'placement'.
|
||||
#
|
||||
# [*region*]
|
||||
# Region for endpoint. Defaults to 'RegionOne'.
|
||||
#
|
||||
# [*service_name*]
|
||||
# (optional) Name of the service.
|
||||
# Defaults to the value of 'placement'.
|
||||
#
|
||||
# [*service_description*]
|
||||
# (optional) Description of the service.
|
||||
# Default to 'Placement Service'
|
||||
#
|
||||
# [*public_url*]
|
||||
# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1/placement')
|
||||
# This url should *not* contain any trailing '/'.
|
||||
#
|
||||
# [*admin_url*]
|
||||
# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1/placement')
|
||||
# This url should *not* contain any trailing '/'.
|
||||
#
|
||||
# [*internal_url*]
|
||||
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1/placement')
|
||||
#
|
||||
class placement::keystone::auth (
|
||||
$password,
|
||||
$ensure = 'present',
|
||||
$auth_name = 'placement',
|
||||
$email = 'placement@localhost',
|
||||
$tenant = 'services',
|
||||
$configure_endpoint = true,
|
||||
$configure_user = true,
|
||||
$configure_user_role = true,
|
||||
$service_name = 'placement',
|
||||
$service_description = 'Placement Service',
|
||||
$service_type = 'placement',
|
||||
$region = 'RegionOne',
|
||||
$public_url = 'http://127.0.0.1/placement',
|
||||
$admin_url = 'http://127.0.0.1/placement',
|
||||
$internal_url = 'http://127.0.0.1/placement',
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
if $configure_user_role {
|
||||
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'placement-server' |>
|
||||
}
|
||||
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| name == 'placement-server' |>
|
||||
|
||||
keystone::resource::service_identity { 'placement':
|
||||
ensure => $ensure,
|
||||
configure_user => $configure_user,
|
||||
configure_user_role => $configure_user_role,
|
||||
configure_endpoint => $configure_endpoint,
|
||||
service_name => $service_name,
|
||||
service_type => $service_type,
|
||||
service_description => $service_description,
|
||||
region => $region,
|
||||
auth_name => $auth_name,
|
||||
password => $password,
|
||||
email => $email,
|
||||
tenant => $tenant,
|
||||
public_url => $public_url,
|
||||
internal_url => $internal_url,
|
||||
admin_url => $admin_url,
|
||||
}
|
||||
|
||||
}
|
235
manifests/keystone/authtoken.pp
Normal file
235
manifests/keystone/authtoken.pp
Normal file
@ -0,0 +1,235 @@
|
||||
# class: placement::keystone::auth
|
||||
#
|
||||
# Configure the keystone_authtoken section in the configuration file
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*username*]
|
||||
# (Optional) The name of the service user
|
||||
# Defaults to 'placement'
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to create for the service user
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (Optional) The URL to use for authentication.
|
||||
# Defaults to 'http://localhost:5000'.
|
||||
#
|
||||
# [*project_name*]
|
||||
# (Optional) Service project name
|
||||
# Defaults to 'services'
|
||||
#
|
||||
# [*user_domain_name*]
|
||||
# (Optional) Name of domain for $username
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*project_domain_name*]
|
||||
# (Optional) Name of domain for $project_name
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*insecure*]
|
||||
# (Optional) If true, explicitly allow TLS without checking server cert
|
||||
# against any certificate authorities. WARNING: not recommended. Use with
|
||||
# caution.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*auth_section*]
|
||||
# (Optional) Config Section from which to load plugin specific options
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*auth_type*]
|
||||
# (Optional) Authentication type to load
|
||||
# Defaults to 'password'.
|
||||
#
|
||||
# [*www_authenticate_uri*]
|
||||
# (Optional) Complete public Identity API endpoint.
|
||||
# Defaults to 'http://localhost:5000'.
|
||||
#
|
||||
# [*auth_version*]
|
||||
# (Optional) API version of the admin Identity API endpoint.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*cache*]
|
||||
# (Optional) Env key for the swift cache.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*cafile*]
|
||||
# (Optional) A PEM encoded Certificate Authority to use when verifying HTTPs
|
||||
# connections.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*certfile*]
|
||||
# (Optional) Required if identity server requires client certificate
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*delay_auth_decision*]
|
||||
# (Optional) Do not handle authorization requests within the middleware, but
|
||||
# delegate the authorization decision to downstream WSGI components. Boolean
|
||||
# value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*enforce_token_bind*]
|
||||
# (Optional) Used to control the use and type of token binding. Can be set
|
||||
# to: "disabled" to not check token binding. "permissive" (default) to
|
||||
# validate binding information if the bind type is of a form known to the
|
||||
# server and ignore it if not. "strict" like "permissive" but if the bind
|
||||
# type is unknown the token will be rejected. "required" any form of token
|
||||
# binding is needed to be allowed. Finally the name of a binding method that
|
||||
# must be present in tokens. String value.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*http_connect_timeout*]
|
||||
# (Optional) Request timeout value for communicating with Identity API
|
||||
# server.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*http_request_max_retries*]
|
||||
# (Optional) How many times are we trying to reconnect when communicating
|
||||
# with Identity API Server. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*include_service_catalog*]
|
||||
# (Optional) Indicate whether to set the X-Service-Catalog header. If False,
|
||||
# middleware will not ask for service catalog on token validation and will
|
||||
# not set the X-Service-Catalog header. Boolean value.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*keyfile*]
|
||||
# (Optional) Required if identity server requires client certificate
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_pool_conn_get_timeout*]
|
||||
# (Optional) Number of seconds that an operation will wait to get a memcached
|
||||
# client connection from the pool. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_pool_dead_retry*]
|
||||
# (Optional) Number of seconds memcached server is considered dead before it
|
||||
# is tried again. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_pool_maxsize*]
|
||||
# (Optional) Maximum total number of open connections to every memcached
|
||||
# server. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_pool_socket_timeout*]
|
||||
# (Optional) Number of seconds a connection to memcached is held unused in
|
||||
# the pool before it is closed. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_pool_unused_timeout*]
|
||||
# (Optional) Number of seconds a connection to memcached is held unused in
|
||||
# the pool before it is closed. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_secret_key*]
|
||||
# (Optional, mandatory if memcache_security_strategy is defined) This string
|
||||
# is used for key derivation.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_security_strategy*]
|
||||
# (Optional) If defined, indicate whether token data should be authenticated
|
||||
# or authenticated and encrypted. If MAC, token data is authenticated (with
|
||||
# HMAC) in the cache. If ENCRYPT, token data is encrypted and authenticated in the
|
||||
# cache. If the value is not one of these options or empty, auth_token will
|
||||
# raise an exception on initialization.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcache_use_advanced_pool*]
|
||||
# (Optional) Use the advanced (eventlet safe) memcached client pool. The
|
||||
# advanced pool will only work under python 2.x Boolean value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*memcached_servers*]
|
||||
# (Optional) Optionally specify a list of memcached server(s) to use for
|
||||
# caching. If left undefined, tokens will instead be cached in-process.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*manage_memcache_package*]
|
||||
# (Optional) Whether to install the python-memcache package.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) The region in which the identity server can be found.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*token_cache_time*]
|
||||
# (Optional) In order to prevent excessive effort spent validating tokens,
|
||||
# the middleware caches previously-seen tokens for a configurable duration
|
||||
# (in seconds). Set to -1 to disable caching completely. Integer value
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class placement::keystone::authtoken(
|
||||
$password,
|
||||
$username = 'placement',
|
||||
$auth_url = 'http://localhost:5000',
|
||||
$project_name = 'services',
|
||||
$user_domain_name = 'Default',
|
||||
$project_domain_name = 'Default',
|
||||
$insecure = $::os_service_default,
|
||||
$auth_section = $::os_service_default,
|
||||
$auth_type = 'password',
|
||||
$www_authenticate_uri = 'http://localhost:5000',
|
||||
$auth_version = $::os_service_default,
|
||||
$cache = $::os_service_default,
|
||||
$cafile = $::os_service_default,
|
||||
$certfile = $::os_service_default,
|
||||
$delay_auth_decision = $::os_service_default,
|
||||
$enforce_token_bind = $::os_service_default,
|
||||
$http_connect_timeout = $::os_service_default,
|
||||
$http_request_max_retries = $::os_service_default,
|
||||
$include_service_catalog = $::os_service_default,
|
||||
$keyfile = $::os_service_default,
|
||||
$memcache_pool_conn_get_timeout = $::os_service_default,
|
||||
$memcache_pool_dead_retry = $::os_service_default,
|
||||
$memcache_pool_maxsize = $::os_service_default,
|
||||
$memcache_pool_socket_timeout = $::os_service_default,
|
||||
$memcache_pool_unused_timeout = $::os_service_default,
|
||||
$memcache_secret_key = $::os_service_default,
|
||||
$memcache_security_strategy = $::os_service_default,
|
||||
$memcache_use_advanced_pool = $::os_service_default,
|
||||
$memcached_servers = $::os_service_default,
|
||||
$manage_memcache_package = false,
|
||||
$region_name = $::os_service_default,
|
||||
$token_cache_time = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
keystone::resource::authtoken { 'placement_config':
|
||||
username => $username,
|
||||
password => $password,
|
||||
project_name => $project_name,
|
||||
auth_url => $auth_url,
|
||||
www_authenticate_uri => $www_authenticate_uri,
|
||||
auth_version => $auth_version,
|
||||
auth_type => $auth_type,
|
||||
auth_section => $auth_section,
|
||||
user_domain_name => $user_domain_name,
|
||||
project_domain_name => $project_domain_name,
|
||||
insecure => $insecure,
|
||||
cache => $cache,
|
||||
cafile => $cafile,
|
||||
certfile => $certfile,
|
||||
delay_auth_decision => $delay_auth_decision,
|
||||
enforce_token_bind => $enforce_token_bind,
|
||||
http_connect_timeout => $http_connect_timeout,
|
||||
http_request_max_retries => $http_request_max_retries,
|
||||
include_service_catalog => $include_service_catalog,
|
||||
keyfile => $keyfile,
|
||||
memcache_pool_conn_get_timeout => $memcache_pool_conn_get_timeout,
|
||||
memcache_pool_dead_retry => $memcache_pool_dead_retry,
|
||||
memcache_pool_maxsize => $memcache_pool_maxsize,
|
||||
memcache_pool_socket_timeout => $memcache_pool_socket_timeout,
|
||||
memcache_secret_key => $memcache_secret_key,
|
||||
memcache_security_strategy => $memcache_security_strategy,
|
||||
memcache_use_advanced_pool => $memcache_use_advanced_pool,
|
||||
memcache_pool_unused_timeout => $memcache_pool_unused_timeout,
|
||||
memcached_servers => $memcached_servers,
|
||||
manage_memcache_package => $manage_memcache_package,
|
||||
region_name => $region_name,
|
||||
token_cache_time => $token_cache_time,
|
||||
}
|
||||
}
|
||||
|
149
manifests/logging.pp
Normal file
149
manifests/logging.pp
Normal file
@ -0,0 +1,149 @@
|
||||
# Class placement::logging
|
||||
#
|
||||
# placement logging configuration
|
||||
#
|
||||
# == parameters
|
||||
#
|
||||
# [*debug*]
|
||||
# (Optional) Should the daemons log debug messages
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*use_syslog*]
|
||||
# (Optional) Use syslog for logging.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*use_json*]
|
||||
# (Optional) Use json for logging.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*use_journal*]
|
||||
# (Optional) Use journal for logging.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*use_stderr*]
|
||||
# (optional) Use stderr for logging
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*syslog_log_facility*]
|
||||
# (Optional) Syslog facility to receive log lines.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*log_dir*]
|
||||
# (optional) Directory where logs should be stored.
|
||||
# If set to boolean false, it will not log to any directory.
|
||||
# Defaults to '/var/log/placement'.
|
||||
#
|
||||
# [*log_file*]
|
||||
# (optional) File where logs should be stored.
|
||||
# Defaults to '/var/log/placement/placement.log'
|
||||
#
|
||||
# [*logging_context_format_string*]
|
||||
# (optional) Format string to use for log messages with context.
|
||||
# Defaults to $::os_service_default
|
||||
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
|
||||
# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
|
||||
#
|
||||
# [*logging_default_format_string*]
|
||||
# (optional) Format string to use for log messages without context.
|
||||
# Defaults to $::os_service_default
|
||||
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
|
||||
# [-] %(instance)s%(message)s'
|
||||
#
|
||||
# [*logging_debug_format_suffix*]
|
||||
# (optional) Formatted data to append to log format when level is DEBUG.
|
||||
# Defaults to $::os_service_default
|
||||
# Example: '%(funcName)s %(pathname)s:%(lineno)d'
|
||||
#
|
||||
# [*logging_exception_prefix*]
|
||||
# (optional) Prefix each line of exception output with this format.
|
||||
# Defaults to $::os_service_default
|
||||
# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
|
||||
#
|
||||
# [*log_config_append*]
|
||||
# (optional) The name of an additional logging configuration file.
|
||||
# Defaults to $::os_service_default
|
||||
# See https://docs.python.org/2/howto/logging.html
|
||||
#
|
||||
# [*default_log_levels*]
|
||||
# (optional) Hash of logger (keys) and level (values) pairs.
|
||||
# Defaults to $::os_service_default
|
||||
# Example:
|
||||
# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
||||
# 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
|
||||
# 'oslo.messaging' => 'INFO', 'iso8601' => 'WARN',
|
||||
# 'requests.packages.urllib3.connectionpool' => 'WARN',
|
||||
# 'urllib3.connectionpool' => 'WARN',
|
||||
# 'websocket' => 'WARN', 'placementmiddleware' => 'WARN',
|
||||
# 'routes.middleware' => 'WARN', stevedore => 'WARN' }
|
||||
#
|
||||
# [*publish_errors*]
|
||||
# (optional) Publish error events (boolean value).
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*fatal_deprecations*]
|
||||
# (optional) Make deprecations fatal (boolean value)
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*instance_format*]
|
||||
# (optional) If an instance is passed with the log message, format it
|
||||
# like this (string value).
|
||||
# Defaults to undef.
|
||||
# Example: '[instance: %(uuid)s] '
|
||||
#
|
||||
# [*instance_uuid_format*]
|
||||
# (optional) If an instance UUID is passed with the log message, format
|
||||
# it like this (string value).
|
||||
# Defaults to $::os_service_default
|
||||
# Example: instance_uuid_format='[instance: %(uuid)s] '
|
||||
#
|
||||
# [*log_date_format*]
|
||||
# (optional) Format string for %%(asctime)s in log records.
|
||||
# Defaults to $::os_service_default
|
||||
# Example: 'Y-%m-%d %H:%M:%S'
|
||||
|
||||
class placement::logging(
|
||||
$use_syslog = $::os_service_default,
|
||||
$use_json = $::os_service_default,
|
||||
$use_journal = $::os_service_default,
|
||||
$use_stderr = $::os_service_default,
|
||||
$syslog_log_facility = $::os_service_default,
|
||||
$log_dir = '/var/log/placement',
|
||||
$log_file = '/var/log/placement/placement.log',
|
||||
$debug = $::os_service_default,
|
||||
$logging_context_format_string = $::os_service_default,
|
||||
$logging_default_format_string = $::os_service_default,
|
||||
$logging_debug_format_suffix = $::os_service_default,
|
||||
$logging_exception_prefix = $::os_service_default,
|
||||
$log_config_append = $::os_service_default,
|
||||
$default_log_levels = $::os_service_default,
|
||||
$publish_errors = $::os_service_default,
|
||||
$fatal_deprecations = $::os_service_default,
|
||||
$instance_format = $::os_service_default,
|
||||
$instance_uuid_format = $::os_service_default,
|
||||
$log_date_format = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
oslo::log { 'placement_config':
|
||||
use_stderr => $use_stderr,
|
||||
use_syslog => $use_syslog,
|
||||
use_json => $use_json,
|
||||
use_journal => $use_journal,
|
||||
log_dir => $log_dir,
|
||||
log_file => $log_file,
|
||||
debug => $debug,
|
||||
logging_context_format_string => $logging_context_format_string,
|
||||
logging_default_format_string => $logging_default_format_string,
|
||||
logging_debug_format_suffix => $logging_debug_format_suffix,
|
||||
logging_exception_prefix => $logging_exception_prefix,
|
||||
log_config_append => $log_config_append,
|
||||
default_log_levels => $default_log_levels,
|
||||
publish_errors => $publish_errors,
|
||||
fatal_deprecations => $fatal_deprecations,
|
||||
instance_format => $instance_format,
|
||||
instance_uuid_format => $instance_uuid_format,
|
||||
log_date_format => $log_date_format,
|
||||
syslog_log_facility => $syslog_log_facility,
|
||||
}
|
||||
}
|
46
manifests/params.pp
Normal file
46
manifests/params.pp
Normal file
@ -0,0 +1,46 @@
|
||||
# Parameters for puppet-placement
|
||||
#
|
||||
class placement::params {
|
||||
|
||||
include ::placement::deps
|
||||
|
||||
include ::openstacklib::defaults
|
||||
if ($::os_package_type == 'debian') or ($::operatingsystem == 'Fedora') {
|
||||
$pyvers = '3'
|
||||
} else {
|
||||
$pyvers = '2'
|
||||
}
|
||||
$group = 'placement'
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# package names
|
||||
$package_name = 'openstack-placement-api'
|
||||
$common_package_name = 'openstack-placement-common'
|
||||
$python_package_name = "python${pyvers}-placement"
|
||||
$service_name = 'httpd'
|
||||
$public_url = 'http://127.0.0.1/placement'
|
||||
$internal_url = 'http://127.0.0.1/placement'
|
||||
$admin_url = 'http://127.0.0.1/placement'
|
||||
$wsgi_script_source = '/usr/bin/placement-api'
|
||||
$wsgi_script_path = '/var/www/cgi-bin/placement'
|
||||
$httpd_config_file = '/etc/httpd/conf.d/00-placement-api.conf'
|
||||
|
||||
}
|
||||
'Debian': {
|
||||
$package_name = 'placement-api'
|
||||
$common_package_name = 'placement-common'
|
||||
$python_package_name = "python${pyvers}-placement"
|
||||
$service_name = 'placement-api'
|
||||
$public_url = 'http://127.0.0.1'
|
||||
$internal_url = 'http://127.0.0.1'
|
||||
$admin_url = 'http://127.0.0.1'
|
||||
$wsgi_script_source = '/usr/bin/placement-api'
|
||||
$wsgi_script_path = '/var/www/cgi-bin/placement'
|
||||
$httpd_config_file = '/etc/apache2/sites-available/nova-placement-api.conf'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem")
|
||||
}
|
||||
} # Case $::osfamily
|
||||
}
|
46
manifests/policy.pp
Normal file
46
manifests/policy.pp
Normal file
@ -0,0 +1,46 @@
|
||||
# == Class: placement::policy
|
||||
#
|
||||
# Configure the placement policies
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*policies*]
|
||||
# (optional) Set of policies to configure for placement
|
||||
# Example :
|
||||
# {
|
||||
# 'placement-context_is_admin' => {
|
||||
# 'key' => 'context_is_admin',
|
||||
# 'value' => 'true'
|
||||
# },
|
||||
# 'placement-default' => {
|
||||
# 'key' => 'default',
|
||||
# 'value' => 'rule:admin_or_owner'
|
||||
# }
|
||||
# }
|
||||
# Defaults to empty hash.
|
||||
#
|
||||
# [*policy_path*]
|
||||
# (optional) Path to the nova policy.json file
|
||||
# Defaults to /etc/placement/policy.json
|
||||
#
|
||||
class placement::policy (
|
||||
$policies = {},
|
||||
$policy_path = '/etc/placement/policy.json',
|
||||
) {
|
||||
|
||||
include ::placement::deps
|
||||
include ::placement::params
|
||||
|
||||
validate_hash($policies)
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
file_path => $policy_path,
|
||||
file_user => 'root',
|
||||
file_group => $::placement::params::group,
|
||||
}
|
||||
|
||||
create_resources('openstacklib::policy::base', $policies)
|
||||
|
||||
oslo::policy { 'placement_config': policy_file => $policy_path }
|
||||
|
||||
}
|
157
manifests/wsgi/apache.pp
Normal file
157
manifests/wsgi/apache.pp
Normal file
@ -0,0 +1,157 @@
|
||||
#
|
||||
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Class to serve Placement API service.
|
||||
|
||||
# Serving Placement API from apache is the recommended way to go for production
|
||||
# because of limited performance for concurrent accesses.
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*servername*]
|
||||
# The servername for the virtualhost.
|
||||
# Optional. Defaults to $::fqdn
|
||||
#
|
||||
# [*api_port*]
|
||||
# The port for Placement API service.
|
||||
# Optional. Defaults to 80
|
||||
#
|
||||
# [*bind_host*]
|
||||
# The host/ip address Apache will listen on.
|
||||
# Optional. Defaults to undef (listen on all ip addresses).
|
||||
#
|
||||
# [*path*]
|
||||
# The prefix for the endpoint.
|
||||
# Optional. Defaults to '/placement'
|
||||
#
|
||||
# [*ssl*]
|
||||
# Use ssl ? (boolean)
|
||||
# Optional. Defaults to true
|
||||
#
|
||||
# [*workers*]
|
||||
# Number of WSGI workers to spawn.
|
||||
# Optional. Defaults to 1
|
||||
#
|
||||
# [*priority*]
|
||||
# (optional) The priority for the vhost.
|
||||
# Defaults to '10'
|
||||
#
|
||||
# [*threads*]
|
||||
# (optional) The number of threads for the vhost.
|
||||
# Defaults to $::os_workers
|
||||
#
|
||||
# [*wsgi_process_display_name*]
|
||||
# (optional) Name of the WSGI process display-name.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) Control the ensure parameter for the Placement API package ressource.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*ssl_cert*]
|
||||
# [*ssl_key*]
|
||||
# [*ssl_chain*]
|
||||
# [*ssl_ca*]
|
||||
# [*ssl_crl_path*]
|
||||
# [*ssl_crl*]
|
||||
# [*ssl_certs_dir*]
|
||||
# apache::vhost ssl parameters.
|
||||
# Optional. Default to apache::vhost 'ssl_*' defaults.
|
||||
#
|
||||
# == Examples
|
||||
#
|
||||
# include apache
|
||||
#
|
||||
# class { 'placement::wsgi::apache': }
|
||||
#
|
||||
class placement::wsgi::apache (
|
||||
$servername = $::fqdn,
|
||||
$api_port = 80,
|
||||
$bind_host = undef,
|
||||
$path = '/placement',
|
||||
$ssl = true,
|
||||
$workers = 1,
|
||||
$ssl_cert = undef,
|
||||
$ssl_key = undef,
|
||||
$ssl_chain = undef,
|
||||
$ssl_ca = undef,
|
||||
$ssl_crl_path = undef,
|
||||
$ssl_crl = undef,
|
||||
$ssl_certs_dir = undef,
|
||||
$wsgi_process_display_name = undef,
|
||||
$threads = $::os_workers,
|
||||
$priority = '10',
|
||||
$ensure_package = 'present',
|
||||
) {
|
||||
|
||||
include ::placement::params
|
||||
include ::apache
|
||||
include ::apache::mod::wsgi
|
||||
if $ssl {
|
||||
include ::apache::mod::ssl
|
||||
}
|
||||
|
||||
placement::generic_service { 'api':
|
||||
service_name => false,
|
||||
package_name => $::placement::params::package_name,
|
||||
ensure_package => $ensure_package,
|
||||
}
|
||||
|
||||
file { $::placement::params::httpd_config_file:
|
||||
ensure => present,
|
||||
content => "#
|
||||
# This file has been cleaned by Puppet.
|
||||
#
|
||||
# OpenStack Placement API configuration has been moved to:
|
||||
# - ${priority}-placement_wsgi.conf
|
||||
#",
|
||||
}
|
||||
# Ubuntu requires placement-api to be installed before apache to find wsgi script
|
||||
Package<| title == 'placement-api'|> -> Package<| title == 'httpd'|>
|
||||
Package<| title == 'placement-api' |> ->
|
||||
File[$::placement::params::httpd_config_file] ~>
|
||||
Service['httpd']
|
||||
|
||||
Service <| title == 'httpd' |> { tag +> 'placement-service' }
|
||||
|
||||
::openstacklib::wsgi::apache { 'placement_wsgi':
|
||||
bind_host => $bind_host,
|
||||
bind_port => $api_port,
|
||||
group => 'placement',
|
||||
path => $path,
|
||||
priority => $priority,
|
||||
servername => $servername,
|
||||
ssl => $ssl,
|
||||
ssl_ca => $ssl_ca,
|
||||
ssl_cert => $ssl_cert,
|
||||
ssl_certs_dir => $ssl_certs_dir,
|
||||
ssl_chain => $ssl_chain,
|
||||
ssl_crl => $ssl_crl,
|
||||
ssl_crl_path => $ssl_crl_path,
|
||||
ssl_key => $ssl_key,
|
||||
threads => $threads,
|
||||
user => 'placement',
|
||||
workers => $workers,
|
||||
wsgi_daemon_process => 'placement-api',
|
||||
wsgi_process_display_name => $wsgi_process_display_name,
|
||||
wsgi_process_group => 'placement-api',
|
||||
wsgi_script_dir => $::placement::params::wsgi_script_path,
|
||||
wsgi_script_file => 'placement-api',
|
||||
wsgi_script_source => $::placement::params::wsgi_script_source,
|
||||
}
|
||||
|
||||
}
|
69
metadata.json
Normal file
69
metadata.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"author": "OpenStack Contributors",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "puppetlabs/inifile",
|
||||
"version_requirement": ">=2.0.0 <3.0.0"
|
||||
},
|
||||
{
|
||||
"name": "puppetlabs/stdlib",
|
||||
"version_requirement": ">=4.0.0 <5.0.0"
|
||||
},
|
||||
{
|
||||
"name": "openstack/keystone",
|
||||
"version_requirement": ">=11.0.0 <12.0.0"
|
||||
},
|
||||
{
|
||||
"name": "openstack/openstacklib",
|
||||
"version_requirement": ">=11.0.0 <12.0.0"
|
||||
},
|
||||
{
|
||||
"name": "openstack/oslo",
|
||||
"version_requirement": ">=11.0.0 <12.0.0"
|
||||
},
|
||||
{
|
||||
"name": "puppetlabs/apache",
|
||||
"version_requirement": ">=1.0.0 <2.0.0"
|
||||
}
|
||||
],
|
||||
"description": "Installs and configures OpenStack Placement.",
|
||||
"issues_url": "https://bugs.launchpad.net/puppet-placement",
|
||||
"license": "Apache-2.0",
|
||||
"name": "openstack-placement",
|
||||
"operatingsystem_support": [
|
||||
{
|
||||
"operatingsystem": "Debian",
|
||||
"operatingsystemrelease": [
|
||||
"9"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Fedora",
|
||||
"operatingsystemrelease": [
|
||||
"28"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "RedHat",
|
||||
"operatingsystemrelease": [
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Ubuntu",
|
||||
"operatingsystemrelease": [
|
||||
"18.04"
|
||||
]
|
||||
}
|
||||
],
|
||||
"project_page": "https://launchpad.net/puppet-placement",
|
||||
"requirements": [
|
||||
{
|
||||
"name": "puppet",
|
||||
"version_requirement": "4.x"
|
||||
}
|
||||
],
|
||||
"source": "git://github.com/openstack/puppet-placement.git",
|
||||
"summary": "Puppet module for OpenStack Placement",
|
||||
"version": "14.0.0"
|
||||
}
|
0
releasenotes/source/_static/.placeholder
Normal file
0
releasenotes/source/_static/.placeholder
Normal file
263
releasenotes/source/conf.py
Normal file
263
releasenotes/source/conf.py
Normal file
@ -0,0 +1,263 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'openstackdocstheme',
|
||||
'reno.sphinxext',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'puppet-placement Release Notes'
|
||||
copyright = u'2018, Puppet OpenStack Developers'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.0.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.0.1'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'openstackdocs'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
# html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
html_last_updated_fmt = '%Y-%m-%d %H:%M'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'puppet-placementReleaseNotesdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'puppet-placementReleaseNotes.tex', u'puppet-placement Release Notes Documentation',
|
||||
u'2018, Puppet OpenStack Developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'puppet-placementreleasenotes', u'puppet-placement Release Notes Documentation',
|
||||
[u'2018, Puppet OpenStack Developers'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'puppet-placementReleaseNotes', u'puppet-placement Release Notes Documentation',
|
||||
u'2018, Puppet OpenStack Developers', 'puppet-placementReleaseNotes', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
# -- Options for Internationalization output ------------------------------
|
||||
locale_dirs = ['locale/']
|
18
releasenotes/source/index.rst
Normal file
18
releasenotes/source/index.rst
Normal file
@ -0,0 +1,18 @@
|
||||
==========================================
|
||||
Welcome to puppet-placement Release Notes!
|
||||
==========================================
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
unreleased
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`search`
|
5
releasenotes/source/unreleased.rst
Normal file
5
releasenotes/source/unreleased.rst
Normal file
@ -0,0 +1,5 @@
|
||||
==============================
|
||||
Current Series Release Notes
|
||||
==============================
|
||||
|
||||
.. release-notes::
|
13
setup.cfg
Normal file
13
setup.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
[metadata]
|
||||
name = puppet-placement
|
||||
summary = Puppet module for OpenStack placement
|
||||
description-file =
|
||||
README.md
|
||||
author = OpenStack
|
||||
author-email = openstack-dicuss@lists.openstack.org
|
||||
home-page = https://docs.openstack.org/puppet-openstack-guide/latest
|
||||
classifier =
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
22
setup.py
Normal file
22
setup.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
11
spec/acceptance/nodesets/centos-70-x64.yml
Normal file
11
spec/acceptance/nodesets/centos-70-x64.yml
Normal file
@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
centos-server-70-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: el-7-x86_64
|
||||
box: puppetlabs/centos-7.0-64-nocm
|
||||
box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm
|
||||
hypervisor: vagrant
|
||||
CONFIG:
|
||||
log_level: debug
|
||||
type: foss
|
10
spec/acceptance/nodesets/default.yml
Normal file
10
spec/acceptance/nodesets/default.yml
Normal file
@ -0,0 +1,10 @@
|
||||
HOSTS:
|
||||
ubuntu-server-14.04-amd64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
box: puppetlabs/ubuntu-14.04-64-nocm
|
||||
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
|
||||
hypervisor: vagrant
|
||||
CONFIG:
|
||||
type: foss
|
10
spec/acceptance/nodesets/nodepool-bionic.yml
Normal file
10
spec/acceptance/nodesets/nodepool-bionic.yml
Normal file
@ -0,0 +1,10 @@
|
||||
HOSTS:
|
||||
ubuntu-18.04-amd64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-18.04-amd64
|
||||
hypervisor: none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
||||
set_env: false
|
10
spec/acceptance/nodesets/nodepool-centos7.yml
Normal file
10
spec/acceptance/nodesets/nodepool-centos7.yml
Normal file
@ -0,0 +1,10 @@
|
||||
HOSTS:
|
||||
centos-70-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: el-7-x86_64
|
||||
hypervisor: none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
||||
set_env: false
|
10
spec/acceptance/nodesets/nodepool-trusty.yml
Normal file
10
spec/acceptance/nodesets/nodepool-trusty.yml
Normal file
@ -0,0 +1,10 @@
|
||||
HOSTS:
|
||||
ubuntu-14.04-amd64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
hypervisor: none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
||||
set_env: false
|
10
spec/acceptance/nodesets/nodepool-xenial.yml
Normal file
10
spec/acceptance/nodesets/nodepool-xenial.yml
Normal file
@ -0,0 +1,10 @@
|
||||
HOSTS:
|
||||
ubuntu-16.04-amd64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-16.04-amd64
|
||||
hypervisor: none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
||||
set_env: false
|
11
spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Normal file
11
spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Normal file
@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-14.04-amd64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
box: puppetlabs/ubuntu-14.04-64-nocm
|
||||
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
|
||||
hypervisor: vagrant
|
||||
CONFIG:
|
||||
log_level: debug
|
||||
type: foss
|
76
spec/classes/placement_config_spec.rb
Normal file
76
spec/classes/placement_config_spec.rb
Normal file
@ -0,0 +1,76 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::config' do
|
||||
|
||||
let :default_params do
|
||||
{ :auth_type => 'password',
|
||||
:project_name => 'services',
|
||||
:project_domain_name => 'Default',
|
||||
:region_name => 'RegionOne',
|
||||
:username => 'placement',
|
||||
:user_domain_name => 'Default',
|
||||
:auth_url => 'http://127.0.0.1:5000/v3',
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :password => 's3cr3t' }
|
||||
end
|
||||
|
||||
shared_examples 'placement::config' do
|
||||
|
||||
context 'with required parameters' do
|
||||
it 'configures [placement] parameters in placement.conf' do
|
||||
is_expected.to contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
|
||||
is_expected.to contain_placement_config('placement/auth_type').with_value(default_params[:auth_type])
|
||||
is_expected.to contain_placement_config('placement/project_name').with_value(default_params[:project_name])
|
||||
is_expected.to contain_placement_config('placement/project_domain_name').with_value(default_params[:project_domain_name])
|
||||
is_expected.to contain_placement_config('placement/region_name').with_value(default_params[:region_name])
|
||||
is_expected.to contain_placement_config('placement/valid_interfaces').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('placement/username').with_value(default_params[:username])
|
||||
is_expected.to contain_placement_config('placement/user_domain_name').with_value(default_params[:user_domain_name])
|
||||
is_expected.to contain_placement_config('placement/auth_url').with_value(default_params[:auth_url])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when overriding class parameters' do
|
||||
before do
|
||||
params.merge!(
|
||||
:auth_type => 'password',
|
||||
:project_name => 'service',
|
||||
:project_domain_name => 'default',
|
||||
:region_name => 'RegionTwo',
|
||||
:valid_interfaces => 'internal',
|
||||
:username => 'placement2',
|
||||
:user_domain_name => 'default',
|
||||
:auth_url => 'https://127.0.0.1:5000/v3',
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures [placement] parameters in placement.conf' do
|
||||
is_expected.to contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
|
||||
is_expected.to contain_placement_config('placement/auth_type').with_value(params[:auth_type])
|
||||
is_expected.to contain_placement_config('placement/project_name').with_value(params[:project_name])
|
||||
is_expected.to contain_placement_config('placement/project_domain_name').with_value(params[:project_domain_name])
|
||||
is_expected.to contain_placement_config('placement/region_name').with_value(params[:region_name])
|
||||
is_expected.to contain_placement_config('placement/valid_interfaces').with_value(params[:valid_interfaces])
|
||||
is_expected.to contain_placement_config('placement/username').with_value(params[:username])
|
||||
is_expected.to contain_placement_config('placement/user_domain_name').with_value(params[:user_domain_name])
|
||||
is_expected.to contain_placement_config('placement/auth_url').with_value(params[:auth_url])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'placement::config'
|
||||
end
|
||||
end
|
||||
end
|
73
spec/classes/placement_db_mysql_spec.rb
Normal file
73
spec/classes/placement_db_mysql_spec.rb
Normal file
@ -0,0 +1,73 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::db::mysql' do
|
||||
|
||||
let :pre_condition do
|
||||
'include mysql::server'
|
||||
end
|
||||
|
||||
let :required_params do
|
||||
{ :password => 'fooboozoo_default_password', }
|
||||
end
|
||||
|
||||
shared_examples_for 'placement-db-mysql' do
|
||||
context 'with only required params' do
|
||||
let :params do
|
||||
required_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
|
||||
:user => 'placement',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'placement',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'overriding allowed_hosts param to array' do
|
||||
let :params do
|
||||
{ :allowed_hosts => ['127.0.0.1','%'] }.merge(required_params)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
|
||||
:user => 'placement',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'placement',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
:allowed_hosts => ['127.0.0.1','%']
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'overriding allowed_hosts param to string' do
|
||||
let :params do
|
||||
{ :allowed_hosts => '192.168.1.1' }.merge(required_params)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
|
||||
:user => 'placement',
|
||||
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
|
||||
:dbname => 'placement',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
:allowed_hosts => '192.168.1.1'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'placement-db-mysql'
|
||||
end
|
||||
end
|
||||
end
|
37
spec/classes/placement_db_postgresql_spec.rb
Normal file
37
spec/classes/placement_db_postgresql_spec.rb
Normal file
@ -0,0 +1,37 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::db::postgresql' do
|
||||
|
||||
let :pre_condition do
|
||||
'include postgresql::server'
|
||||
end
|
||||
|
||||
let :required_params do
|
||||
{ :password => 'pw' }
|
||||
end
|
||||
|
||||
shared_examples_for 'placement-db-postgresql' do
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
required_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_postgresql__server__db('placement').with(
|
||||
:user => 'placement',
|
||||
:password => 'md51c1dd6fb4863b046eecc6a6b91f53f7f'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
|
||||
end
|
||||
|
||||
it_behaves_like 'placement-db-postgresql'
|
||||
end
|
||||
end
|
||||
end
|
67
spec/classes/placement_db_spec.rb
Normal file
67
spec/classes/placement_db_spec.rb
Normal file
@ -0,0 +1,67 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::db' do
|
||||
shared_examples 'placement::db' do
|
||||
context 'with default parameters' do
|
||||
it 'configures placement_database' do
|
||||
is_expected.to contain_placement_config('placement_database/connection').with_value('sqlite:////var/lib/placement/placement.sqlite')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
|
||||
}
|
||||
end
|
||||
it 'configures placement_database' do
|
||||
is_expected.to contain_placement_config('placement_database/connection').with_value('mysql+pymysql://placement:placement@localhost/placement')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foodb://placement:placement@localhost/placement', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
end
|
||||
|
||||
context 'with incorrect pymysql database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'foo+pymysql://placement:placement@localhost/placement', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples_for 'placement::db on Debian' do
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement', }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'placement::db on RedHat' do
|
||||
context 'using pymysql driver' do
|
||||
let :params do
|
||||
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement', }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'placement::db'
|
||||
it_configures "placement::db on #{facts[:osfamily]}"
|
||||
end
|
||||
end
|
||||
end
|
42
spec/classes/placement_db_sync_spec.rb
Normal file
42
spec/classes/placement_db_sync_spec.rb
Normal file
@ -0,0 +1,42 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::db::sync' do
|
||||
|
||||
shared_examples_for 'placement-manage-db-sync' do
|
||||
|
||||
it 'runs placement-manage-db-sync' do
|
||||
is_expected.to contain_exec('placement-manage-db-sync').with(
|
||||
:command => 'placement-manage db sync',
|
||||
:path => [ '/bin', '/usr/bin', '/usr/local/bin'],
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:user => 'placement',
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[placement::install::end]',
|
||||
'Anchor[placement::config::end]',
|
||||
'Anchor[placement::db::end]',
|
||||
'Anchor[placement::dbsync::begin]'],
|
||||
:notify => 'Anchor[placement::dbsync::end]',
|
||||
:tag => ['placement-exec', 'openstack-db']
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({
|
||||
:os_workers => 8,
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}))
|
||||
end
|
||||
|
||||
it_configures 'placement-manage-db-sync'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
141
spec/classes/placement_keystone_auth_spec.rb
Normal file
141
spec/classes/placement_keystone_auth_spec.rb
Normal file
@ -0,0 +1,141 @@
|
||||
#
|
||||
# Unit tests for placement::keystone::auth
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::keystone::auth' do
|
||||
shared_examples_for 'placement-keystone-auth' do
|
||||
context 'with default class parameters' do
|
||||
let :params do
|
||||
{ :password => 'placement_password',
|
||||
:tenant => 'foobar' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('placement').with(
|
||||
:ensure => 'present',
|
||||
:password => 'placement_password',
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_user_role('placement@foobar').with(
|
||||
:ensure => 'present',
|
||||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Placement Service'
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1/placement',
|
||||
:admin_url => 'http://127.0.0.1/placement',
|
||||
:internal_url => 'http://127.0.0.1/placement',
|
||||
) }
|
||||
end
|
||||
|
||||
context 'when overriding URL parameters' do
|
||||
let :params do
|
||||
{ :password => 'placement_password',
|
||||
:public_url => 'https://10.10.10.10:80',
|
||||
:internal_url => 'http://10.10.10.11:81',
|
||||
:admin_url => 'http://10.10.10.12:81', }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'https://10.10.10.10:80',
|
||||
:internal_url => 'http://10.10.10.11:81',
|
||||
:admin_url => 'http://10.10.10.12:81',
|
||||
) }
|
||||
end
|
||||
|
||||
context 'when overriding auth name' do
|
||||
let :params do
|
||||
{ :password => 'foo',
|
||||
:auth_name => 'placementy' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('placementy') }
|
||||
it { is_expected.to contain_keystone_user_role('placementy@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement') }
|
||||
end
|
||||
|
||||
context 'when overriding service name' do
|
||||
let :params do
|
||||
{ :service_name => 'placement_service',
|
||||
:auth_name => 'placement',
|
||||
:password => 'placement_password' }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement_service::placement') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/placement_service::placement') }
|
||||
end
|
||||
|
||||
context 'when disabling user configuration' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'placement_password',
|
||||
:configure_user => false
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_keystone_user('placement') }
|
||||
it { is_expected.to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Placement Service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
context 'when disabling user and user role configuration' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'placement_password',
|
||||
:configure_user => false,
|
||||
:configure_user_role => false
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_keystone_user('placement') }
|
||||
it { is_expected.not_to contain_keystone_user_role('placement@services') }
|
||||
it { is_expected.to contain_keystone_service('placement::placement').with(
|
||||
:ensure => 'present',
|
||||
:description => 'Placement Service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
context 'when using ensure absent' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'placement_password',
|
||||
:ensure => 'absent'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone__resource__service_identity('placement').with_ensure('absent') }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'placement-keystone-auth'
|
||||
end
|
||||
end
|
||||
end
|
138
spec/classes/placement_keystone_authtoken_spec.rb
Normal file
138
spec/classes/placement_keystone_authtoken_spec.rb
Normal file
@ -0,0 +1,138 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::keystone::authtoken' do
|
||||
|
||||
let :params do
|
||||
{ :password => 'secrete', }
|
||||
end
|
||||
|
||||
shared_examples 'placement authtoken' do
|
||||
|
||||
context 'with default parameters' do
|
||||
|
||||
it 'configure keystone_authtoken' do
|
||||
is_expected.to contain_placement_config('keystone_authtoken/username').with_value('placement')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/password').with_value('secrete')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_url').with_value('http://localhost:5000')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/project_name').with_value('services')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/user_domain_name').with_value('Default')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/project_domain_name').with_value('Default')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_type').with_value('password')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/www_authenticate_uri').with_value('http://localhost:5000')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:www_authenticate_uri => 'https://10.0.0.1:9999/',
|
||||
:username => 'myuser',
|
||||
:password => 'mypasswd',
|
||||
:auth_url => 'https://127.0.0.1:5000',
|
||||
:project_name => 'service_project',
|
||||
:user_domain_name => 'domainX',
|
||||
:project_domain_name => 'domainX',
|
||||
:insecure => false,
|
||||
:auth_section => 'new_section',
|
||||
:auth_type => 'password',
|
||||
:auth_version => 'v3',
|
||||
:cache => 'somevalue',
|
||||
:cafile => '/opt/stack/data/cafile.pem',
|
||||
:certfile => 'certfile.crt',
|
||||
:delay_auth_decision => false,
|
||||
:enforce_token_bind => 'permissive',
|
||||
:http_connect_timeout => '300',
|
||||
:http_request_max_retries => '3',
|
||||
:include_service_catalog => true,
|
||||
:keyfile => 'keyfile',
|
||||
:memcache_pool_conn_get_timeout => '9',
|
||||
:memcache_pool_dead_retry => '302',
|
||||
:memcache_pool_maxsize => '11',
|
||||
:memcache_pool_socket_timeout => '2',
|
||||
:memcache_pool_unused_timeout => '61',
|
||||
:memcache_secret_key => 'secret_key',
|
||||
:memcache_security_strategy => 'ENCRYPT',
|
||||
:memcache_use_advanced_pool => true,
|
||||
:memcached_servers => ['memcached01:11211','memcached02:11211'],
|
||||
:manage_memcache_package => true,
|
||||
:region_name => 'region2',
|
||||
:token_cache_time => '301',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure keystone_authtoken' do
|
||||
is_expected.to contain_placement_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/username').with_value(params[:username])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_url').with_value(params[:auth_url])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/project_name').with_value(params[:project_name])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/insecure').with_value(params[:insecure])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_section').with_value(params[:auth_section])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_type').with_value(params[:auth_type])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/auth_version').with_value(params[:auth_version])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/cache').with_value(params[:cache])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/cafile').with_value(params[:cafile])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/certfile').with_value(params[:certfile])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/keyfile').with_value(params[:keyfile])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
|
||||
is_expected.to contain_placement_config('keystone_authtoken/region_name').with_value(params[:region_name])
|
||||
is_expected.to contain_placement_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time])
|
||||
end
|
||||
|
||||
it 'installs python memcache package' do
|
||||
is_expected.to contain_package('python-memcache')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'placement authtoken'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
133
spec/classes/placement_logging_spec.rb
Normal file
133
spec/classes/placement_logging_spec.rb
Normal file
@ -0,0 +1,133 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::logging' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
}
|
||||
end
|
||||
|
||||
let :log_params do
|
||||
{
|
||||
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
||||
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
||||
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
||||
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
||||
:log_config_append => '/etc/placement/logging.conf',
|
||||
:publish_errors => true,
|
||||
:default_log_levels => {
|
||||
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
||||
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
|
||||
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
||||
:fatal_deprecations => true,
|
||||
:instance_format => '[instance: %(uuid)s] ',
|
||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
||||
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
||||
:use_syslog => true,
|
||||
:use_json => true,
|
||||
:use_journal => true,
|
||||
:use_stderr => false,
|
||||
:syslog_log_facility => 'LOG_FOO',
|
||||
:log_dir => '/var/log',
|
||||
:log_file => '/var/tmp/placement_random.log',
|
||||
:debug => true,
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'placement-logging' do
|
||||
|
||||
context 'with basic logging options and default settings' do
|
||||
it_configures 'basic default logging settings'
|
||||
end
|
||||
|
||||
context 'with basic logging options and non-default settings' do
|
||||
before { params.merge!( log_params ) }
|
||||
it_configures 'basic non-default logging settings'
|
||||
end
|
||||
|
||||
context 'with extended logging options' do
|
||||
before { params.merge!( log_params ) }
|
||||
it_configures 'logging params set'
|
||||
end
|
||||
|
||||
context 'without extended logging options' do
|
||||
it_configures 'logging params unset'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples 'basic default logging settings' do
|
||||
it 'configures placement logging settings with default values' do
|
||||
is_expected.to contain_oslo__log('placement_config').with(
|
||||
:use_syslog => '<SERVICE DEFAULT>',
|
||||
:use_json => '<SERVICE DEFAULT>',
|
||||
:use_journal => '<SERVICE DEFAULT>',
|
||||
:use_stderr => '<SERVICE DEFAULT>',
|
||||
:syslog_log_facility => '<SERVICE DEFAULT>',
|
||||
:log_dir => '/var/log/placement',
|
||||
:log_file => '/var/log/placement/placement.log',
|
||||
:debug => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'basic non-default logging settings' do
|
||||
it 'configures placement logging settings with non-default values' do
|
||||
is_expected.to contain_oslo__log('placement_config').with(
|
||||
:use_syslog => true,
|
||||
:use_json => true,
|
||||
:use_journal => true,
|
||||
:use_stderr => false,
|
||||
:syslog_log_facility => 'LOG_FOO',
|
||||
:log_dir => '/var/log',
|
||||
:log_file => '/var/tmp/placement_random.log',
|
||||
:debug => true,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'logging params set' do
|
||||
it 'enables logging params' do
|
||||
is_expected.to contain_oslo__log('placement_config').with(
|
||||
:logging_context_format_string =>
|
||||
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
||||
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
||||
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
||||
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
||||
:log_config_append => '/etc/placement/logging.conf',
|
||||
:publish_errors => true,
|
||||
:default_log_levels => {
|
||||
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
||||
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
|
||||
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
||||
:fatal_deprecations => true,
|
||||
:instance_format => '[instance: %(uuid)s] ',
|
||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
||||
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'logging params unset' do
|
||||
[ :logging_context_format_string, :logging_default_format_string,
|
||||
:logging_debug_format_suffix, :logging_exception_prefix,
|
||||
:log_config_append, :publish_errors,
|
||||
:default_log_levels, :fatal_deprecations,
|
||||
:instance_format, :instance_uuid_format,
|
||||
:log_date_format, ].each { |param|
|
||||
it { is_expected.to contain_oslo__log('placement_config').with("#{param}" => '<SERVICE DEFAULT>') }
|
||||
}
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'placement-logging'
|
||||
end
|
||||
end
|
||||
end
|
38
spec/classes/placement_policy_spec.rb
Normal file
38
spec/classes/placement_policy_spec.rb
Normal file
@ -0,0 +1,38 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::policy' do
|
||||
shared_examples_for 'placement-policies' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/placement/policy.json',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
'key' => 'context_is_admin',
|
||||
'value' => 'foo:bar'
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it 'set up the policies' do
|
||||
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
|
||||
:key => 'context_is_admin',
|
||||
:value => 'foo:bar',
|
||||
:file_user => 'root',
|
||||
:file_group => 'placement',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'placement-policies'
|
||||
end
|
||||
end
|
||||
end
|
37
spec/defines/placement_generic_service_spec.rb
Normal file
37
spec/defines/placement_generic_service_spec.rb
Normal file
@ -0,0 +1,37 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'placement::generic_service' do
|
||||
describe 'package should come before service' do
|
||||
let :pre_condition do
|
||||
'include placement'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:package_name => 'foo',
|
||||
:service_name => 'food'
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
let :title do
|
||||
'foo'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('placement-foo').with(
|
||||
'name' => 'food',
|
||||
'ensure' => 'running',
|
||||
'enable' => true
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_service('placement-foo').that_subscribes_to(
|
||||
'Anchor[placement::service::begin]',
|
||||
)}
|
||||
it { is_expected.to contain_service('placement-foo').that_notifies(
|
||||
'Anchor[placement::service::end]',
|
||||
)}
|
||||
end
|
||||
end
|
5
spec/shared_examples.rb
Normal file
5
spec/shared_examples.rb
Normal file
@ -0,0 +1,5 @@
|
||||
shared_examples_for "a Puppet::Error" do |description|
|
||||
it "with message matching #{description.inspect}" do
|
||||
expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
|
||||
end
|
||||
end
|
12
spec/spec_helper.rb
Normal file
12
spec/spec_helper.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# Load libraries from openstacklib here to simulate how they live together in a real puppet run (for provider unit tests)
|
||||
$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib'))
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'shared_examples'
|
||||
require 'puppet-openstack_spec_helper/facts'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
c.alias_it_should_behave_like_to :it_raises, 'raises'
|
||||
end
|
||||
|
||||
at_exit { RSpec::Puppet::Coverage.report! }
|
1
spec/spec_helper_acceptance.rb
Normal file
1
spec/spec_helper_acceptance.rb
Normal file
@ -0,0 +1 @@
|
||||
require 'puppet-openstack_spec_helper/beaker_spec_helper'
|
68
spec/unit/provider/placement_config/ini_setting_spec.rb
Normal file
68
spec/unit/provider/placement_config/ini_setting_spec.rb
Normal file
@ -0,0 +1,68 @@
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programatcally set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:placement_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
|
||||
it 'should default to the default setting when no other one is specified' do
|
||||
resource = Puppet::Type::Placement_config.new(
|
||||
{:name => 'DEFAULT/foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('DEFAULT')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Placement_config.new(
|
||||
{:name => 'dude/foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('dude')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Placement_config.new(
|
||||
{:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
|
||||
it 'should ensure absent when value matches ensure_absent_val' do
|
||||
resource = Puppet::Type::Placement_config.new(
|
||||
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
|
||||
end
|
64
spec/unit/type/placement_config_spec.rb
Normal file
64
spec/unit/type/placement_config_spec.rb
Normal file
@ -0,0 +1,64 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/placement_config'
|
||||
describe 'Puppet::Type.type(:placement_config)' do
|
||||
before :each do
|
||||
@placement_config = Puppet::Type.type(:placement_config).new(:name => 'DEFAULT/foo', :value => 'bar')
|
||||
end
|
||||
|
||||
it 'should require a name' do
|
||||
expect {
|
||||
Puppet::Type.type(:placement_config).new({})
|
||||
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
||||
end
|
||||
|
||||
it 'should not expect a name with whitespace' do
|
||||
expect {
|
||||
Puppet::Type.type(:placement_config).new(:name => 'f oo')
|
||||
}.to raise_error(Puppet::Error, /Parameter name failed/)
|
||||
end
|
||||
|
||||
it 'should fail when there is no section' do
|
||||
expect {
|
||||
Puppet::Type.type(:placement_config).new(:name => 'foo')
|
||||
}.to raise_error(Puppet::Error, /Parameter name failed/)
|
||||
end
|
||||
|
||||
it 'should not require a value when ensure is absent' do
|
||||
Puppet::Type.type(:placement_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
|
||||
end
|
||||
|
||||
it 'should accept a valid value' do
|
||||
@placement_config[:value] = 'bar'
|
||||
expect(@placement_config[:value]).to eq('bar')
|
||||
end
|
||||
|
||||
it 'should not accept a value with whitespace' do
|
||||
@placement_config[:value] = 'b ar'
|
||||
expect(@placement_config[:value]).to eq('b ar')
|
||||
end
|
||||
|
||||
it 'should accept valid ensure values' do
|
||||
@placement_config[:ensure] = :present
|
||||
expect(@placement_config[:ensure]).to eq(:present)
|
||||
@placement_config[:ensure] = :absent
|
||||
expect(@placement_config[:ensure]).to eq(:absent)
|
||||
end
|
||||
|
||||
it 'should not accept invalid ensure values' do
|
||||
expect {
|
||||
@placement_config[:ensure] = :latest
|
||||
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||
end
|
||||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'placement')
|
||||
catalog.add_resource package, @placement_config
|
||||
dependency = @placement_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
expect(dependency[0].target).to eq(@placement_config)
|
||||
expect(dependency[0].source).to eq(package)
|
||||
end
|
||||
|
||||
|
||||
end
|
12
tox.ini
Normal file
12
tox.ini
Normal file
@ -0,0 +1,12 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
envlist = releasenotes
|
||||
|
||||
[testenv]
|
||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
Loading…
Reference in New Issue
Block a user