Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[inspector] create a separate database configuration for ironic-inspe…
…ctor This service has a separate database that can be configured. This patch is essentially a copy-paste from ironic::db. Change-Id: Ib4d3548e76a9314592d8b66707df1987d7cfc5b9
- Loading branch information
Showing
14 changed files
with
485 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,9 @@ | ||
# | ||
# Class to execute ironic-inspector dbsync | ||
# Class to execute ironic-inspector dbsync (deprecated, use | ||
# ironic::inspector::db::sync instead). | ||
# | ||
class ironic::db::inspector_sync { | ||
warning('ironic::db::inspector_sync is deprecated, please use ironic::inspector::db::sync') | ||
|
||
include ::ironic::deps | ||
include ::ironic::params | ||
|
||
exec { 'ironic-inspector-dbsync': | ||
command => $::ironic::params::inspector_dbsync_command, | ||
path => '/usr/bin', | ||
user => 'ironic-inspector', | ||
refreshonly => true, | ||
logoutput => on_failure, | ||
subscribe => [ | ||
Anchor['ironic-inspector::install::end'], | ||
Anchor['ironic-inspector::config::end'], | ||
Anchor['ironic-inspector::dbsync::begin'] | ||
], | ||
notify => Anchor['ironic-inspector::dbsync::end'], | ||
} | ||
include ::ironic::inspector::db::sync | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# == Class: ironic::inspector::db | ||
# | ||
# Configure the Ironic Inspector database | ||
# | ||
# === Parameters | ||
# | ||
# [*database_connection*] | ||
# Url used to connect to database. | ||
# (Optional) Defaults to 'sqlite:////var/lib/ironic-inspector/inspector.sqlite'. | ||
# | ||
# [*database_idle_timeout*] | ||
# Timeout when db connections should be reaped. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
# [*database_max_retries*] | ||
# Maximum db connection retries during startup. | ||
# Setting -1 implies an infinite retry count. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
# [*database_retry_interval*] | ||
# Interval between retries of opening a sql connection. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
# [*database_min_pool_size*] | ||
# Minimum number of SQL connections to keep open in a pool. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
# [*database_max_pool_size*] | ||
# Maximum number of SQL connections to keep open in a pool. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
# [*database_max_overflow*] | ||
# If set, use this value for max_overflow with sqlalchemy. | ||
# (Optional) Defaults to $::os_service_default | ||
# | ||
class ironic::inspector::db ( | ||
$database_connection = 'sqlite:////var/lib/ironic-inspector/inspector.sqlite', | ||
$database_idle_timeout = $::os_service_default, | ||
$database_max_retries = $::os_service_default, | ||
$database_retry_interval = $::os_service_default, | ||
$database_min_pool_size = $::os_service_default, | ||
$database_max_pool_size = $::os_service_default, | ||
$database_max_overflow = $::os_service_default, | ||
) { | ||
|
||
include ::ironic::params | ||
|
||
$database_connection_real = pick($::ironic::inspector::db_connection, $database_connection) | ||
|
||
validate_re($database_connection_real, | ||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') | ||
|
||
oslo::db { 'ironic_inspector_config': | ||
connection => $database_connection_real, | ||
idle_timeout => $database_idle_timeout, | ||
min_pool_size => $database_min_pool_size, | ||
max_pool_size => $database_max_pool_size, | ||
max_retries => $database_max_retries, | ||
retry_interval => $database_retry_interval, | ||
max_overflow => $database_max_overflow, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
# Copyright (C) 2013 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. | ||
# | ||
# ironic::inspector::db::mysql | ||
# | ||
# [*password*] | ||
# Password to use for the ironic-inspector user | ||
# | ||
# [*dbname*] | ||
# (optional) The name of the database | ||
# Defaults to 'ironic-inspector' | ||
# | ||
# [*user*] | ||
# (optional) The mysql user to create | ||
# Defaults to 'ironic-inspector' | ||
# | ||
# [*host*] | ||
# (optional) The IP address of the mysql server | ||
# Defaults to '127.0.0.1' | ||
# | ||
# [*charset*] | ||
# (optional) The charset to use for the nova database | ||
# Defaults to 'utf8' | ||
# | ||
# [*collate*] | ||
# (optional) The collate to use for the nova database | ||
# Defaults to 'utf8_general_ci' | ||
# | ||
# [*allowed_hosts*] | ||
# (optional) Additional hosts that are allowed to access this DB | ||
# Defaults to undef | ||
# | ||
class ironic::inspector::db::mysql ( | ||
$password, | ||
$dbname = 'ironic-inspector', | ||
$user = 'ironic-inspector', | ||
$host = '127.0.0.1', | ||
$allowed_hosts = undef, | ||
$charset = 'utf8', | ||
$collate = 'utf8_general_ci', | ||
) { | ||
|
||
::openstacklib::db::mysql { 'ironic-inspector': | ||
user => $user, | ||
password_hash => mysql_password($password), | ||
dbname => $dbname, | ||
host => $host, | ||
charset => $charset, | ||
collate => $collate, | ||
allowed_hosts => $allowed_hosts, | ||
} | ||
|
||
::Openstacklib::Db::Mysql['ironic-inspector'] ~> Exec<| title == 'ironic-inspector-dbsync' |> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# == Class: ironic::db::postgresql | ||
# | ||
# Class that configures postgresql for ironic-inspector | ||
# Requires the Puppetlabs postgresql module. | ||
# | ||
# === Parameters | ||
# | ||
# [*password*] | ||
# (Required) Password to connect to the database. | ||
# | ||
# [*dbname*] | ||
# (Optional) Name of the database. | ||
# Defaults to 'ironic-inspector'. | ||
# | ||
# [*user*] | ||
# (Optional) User to connect to the database. | ||
# Defaults to 'ironic-inspector'. | ||
# | ||
# [*encoding*] | ||
# (Optional) The charset to use for the database. | ||
# Default to undef. | ||
# | ||
# [*privileges*] | ||
# (Optional) Privileges given to the database user. | ||
# Default to 'ALL' | ||
# | ||
class ironic::inspector::db::postgresql( | ||
$password, | ||
$dbname = 'ironic-inspector', | ||
$user = 'ironic-inspector', | ||
$encoding = undef, | ||
$privileges = 'ALL', | ||
) { | ||
|
||
Class['ironic::inspector::db::postgresql'] -> Service<| title == 'ironic-inspector' |> | ||
|
||
::openstacklib::db::postgresql { 'ironic-inspector': | ||
password_hash => postgresql_password($user, $password), | ||
dbname => $dbname, | ||
user => $user, | ||
encoding => $encoding, | ||
privileges => $privileges, | ||
} | ||
|
||
::Openstacklib::Db::Postgresql['ironic-inspector'] ~> Exec<| title == 'ironic-inspector-dbsync' |> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Class to execute ironic-inspector dbsync | ||
# | ||
class ironic::inspector::db::sync { | ||
|
||
include ::ironic::deps | ||
include ::ironic::params | ||
|
||
exec { 'ironic-inspector-dbsync': | ||
command => $::ironic::params::inspector_dbsync_command, | ||
path => '/usr/bin', | ||
user => 'ironic-inspector', | ||
refreshonly => true, | ||
logoutput => on_failure, | ||
subscribe => [ | ||
Anchor['ironic-inspector::install::end'], | ||
Anchor['ironic-inspector::config::end'], | ||
Anchor['ironic-inspector::dbsync::begin'] | ||
], | ||
notify => Anchor['ironic-inspector::dbsync::end'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
features: | ||
- New manifest "ironic::inspector::db" for configuring ironic-inspector | ||
oslo.db parameters. | ||
deprecations: | ||
- Manifest "ironic::db::inspector_sync" is deprecated, use | ||
"ironic::inspector::db::sync" instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.