Convert all class usage to relative names

Change-Id: I5b02ee3e4e1a0078f6742137ec38fbff64f9adad
This commit is contained in:
Tobias Urdin 2019-12-08 15:27:31 +01:00
parent 55a0f943a3
commit 525e5a5bbf
23 changed files with 64 additions and 66 deletions

View File

@ -34,12 +34,12 @@
# Mandatory. Get one with `ceph osd pool ls`
#
# [*exec_timeout*] The default exec resource timeout, in seconds
# Optional. Defaults to $::ceph::params::exec_timeout
# Optional. Defaults to $ceph::params::exec_timeout
#
define ceph::fs (
$metadata_pool,
$data_pool,
$exec_timeout = $::ceph::params::exec_timeout,
$exec_timeout = $ceph::params::exec_timeout,
) {
Ceph_config<||> -> Exec["create-fs-${name}"]
Ceph::Pool<||> -> Exec["create-fs-${name}"]

View File

@ -137,7 +137,6 @@
# calling ceph_config from in-house modules will get dup-declaration errors.
# Boolean. Default false.
#
class ceph (
$fsid,
$ensure = present,
@ -174,14 +173,15 @@ class ceph (
# DEPRECATED PARAMETERS
$set_osd_params = false,
) {
include ::ceph::params
include ceph::params
if $set_osd_params {
warning('set_osd_params is deprecated. It is here to allow a transition to using \
this module to assign values and will be removed in a future release.')
}
package { $::ceph::params::packages :
package { $ceph::params::packages :
ensure => $ensure,
tag => 'ceph'
}

View File

@ -129,7 +129,7 @@ define ceph::key (
group => $group,
mode => $mode,
selinux_ignore_defaults => true,
require => Package[$::ceph::params::packages],
require => Package[$ceph::params::packages],
}
}

View File

@ -52,7 +52,7 @@
#
class ceph::mds (
$public_addr = undef,
$pkg_mds = $::ceph::params::pkg_mds,
$pkg_mds = $ceph::params::pkg_mds,
$pkg_mds_ensure = present,
$mds_activate = true,
$mds_data = undef,

View File

@ -36,7 +36,7 @@ define ceph::mirror (
$rbd_mirror_enable = true,
) {
include ::stdlib
include stdlib
ensure_resource( 'package',
$pkg_mirror,

View File

@ -55,7 +55,7 @@
# Optional. $key and $keyring are mutually exclusive.
#
# [*exec_timeout*] The default exec resource timeout, in seconds
# Optional. Defaults to $::ceph::params::exec_timeout
# Optional. Defaults to $ceph::params::exec_timeout
#
define ceph::mon (
$ensure = present,
@ -65,10 +65,10 @@ define ceph::mon (
$authentication_type = 'cephx',
$key = undef,
$keyring = undef,
$exec_timeout = $::ceph::params::exec_timeout,
$exec_timeout = $ceph::params::exec_timeout,
) {
include ::stdlib
include stdlib
# a puppet name translates into a ceph id, the meaning is different
$id = $name

View File

@ -51,14 +51,14 @@
# Optional. Same default as ceph.
#
# [*exec_timeout*] The default exec resource timeout, in seconds
# Optional. Defaults to $::ceph::params::exec_timeout
# Optional. Defaults to $ceph::params::exec_timeout
#
# [*selinux_file_context*] The SELinux file context to apply
# on the directory backing the OSD service.
# Optional. Defaults to 'ceph_var_lib_t'
#
# [*fsid*] The ceph cluster FSID
# Optional. Defaults to $::ceph::profile::params::fsid
# Optional. Defaults to $ceph::profile::params::fsid
#
# [*dmcrypt*] Encrypt [data-path] and/or journal devices with dm-crypt.
# Optional. Defaults to false.
@ -73,14 +73,14 @@ define ceph::osd (
$bluestore_wal = undef,
$bluestore_db = undef,
$store_type = undef,
$exec_timeout = $::ceph::params::exec_timeout,
$exec_timeout = $ceph::params::exec_timeout,
$selinux_file_context = 'ceph_var_lib_t',
$fsid = $::ceph::profile::params::fsid,
$fsid = $ceph::profile::params::fsid,
$dmcrypt = false,
$dmcrypt_key_dir = '/etc/ceph/dmcrypt-keys',
) {
include ::ceph::params
include ceph::params
$data = $name
@ -187,14 +187,14 @@ ceph-volume lvm list ${data}
tag => 'prepare',
}
if (str2bool($::selinux) == true) {
ensure_packages($::ceph::params::pkg_policycoreutils, {'ensure' => 'present'})
ensure_packages($ceph::params::pkg_policycoreutils, {'ensure' => 'present'})
exec { "fcontext_${name}":
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
semanage fcontext -a -t ${selinux_file_context} \"$(readlink -f ${data})(/.*)?\"
restorecon -R $(readlink -f ${data})
",
require => [Package[$::ceph::params::pkg_policycoreutils],Exec[$ceph_prepare]],
require => [Package[$ceph::params::pkg_policycoreutils],Exec[$ceph_prepare]],
before => Exec[$ceph_activate],
unless => "/usr/bin/test -b $(readlink -f ${data}) || (semanage fcontext -l | grep $(readlink -f ${data}))",
}

View File

@ -36,7 +36,7 @@
class ceph::osds(
$args = {},
$defaults = {},
$pid_max = $::ceph::profile::params::pid_max,
$pid_max = $ceph::profile::params::pid_max,
)
{
create_resources(ceph::osd, $args, $defaults)

View File

@ -48,7 +48,7 @@
# cephfs,rbd,rgw or freeform for custom application.
#
# [*exec_timeout*] The default exec resource timeout, in seconds
# Optional. Defaults to $::ceph::params::exec_timeout
# Optional. Defaults to $ceph::params::exec_timeout
#
define ceph::pool (
$ensure = present,
@ -56,7 +56,7 @@ define ceph::pool (
$pgp_num = undef,
$size = undef,
$tag = undef,
$exec_timeout = $::ceph::params::exec_timeout,
$exec_timeout = $ceph::params::exec_timeout,
) {
if $ensure == present {

View File

@ -20,17 +20,17 @@
# Base profile to install ceph and configure /etc/ceph/ceph.conf
#
class ceph::profile::base {
include ::ceph::profile::params
include ceph::profile::params
if ( $ceph::profile::params::manage_repo ) {
Class['ceph::repo'] -> Class['ceph']
class { '::ceph::repo':
class { 'ceph::repo':
release => $ceph::profile::params::release,
}
}
class { '::ceph':
class { 'ceph':
fsid => $ceph::profile::params::fsid,
authentication_type => $ceph::profile::params::authentication_type,
osd_journal_size => $ceph::profile::params::osd_journal_size,

View File

@ -21,13 +21,13 @@
# Profile for a Ceph client
#
class ceph::profile::client {
require ::ceph::profile::base
require ceph::profile::base
# If the same server is hosting a mon, osd and client, the key resource is
# ultimately handled by the mon class.
if ! defined(Class['ceph::keys']) {
if !empty($ceph::profile::params::client_keys) {
class { '::ceph::keys':
class { 'ceph::keys':
args => $ceph::profile::params::client_keys
}
}

View File

@ -20,7 +20,7 @@
# Profile for a Ceph fs
#
class ceph::profile::fs {
require ::ceph::profile::base
require ceph::profile::base
ceph::fs { $ceph::profile::params::fs_name:
metadata_pool => $ceph::profile::params::fs_metadata_pool,

View File

@ -20,9 +20,9 @@
# Profile for a Ceph mds
#
class ceph::profile::mds {
require ::ceph::profile::base
require ceph::profile::base
class { '::ceph::mds':
class { 'ceph::mds':
public_addr => $ceph::profile::params::public_addr,
}

View File

@ -20,7 +20,7 @@
# Profile for a Ceph mgr
#
class ceph::profile::mgr {
require ::ceph::profile::base
require ceph::profile::base
ceph::mgr { $::hostname:
authentication_type => $ceph::profile::params::authentication_type,

View File

@ -20,10 +20,10 @@
# Profile for Ceph rbd mirror
#
class ceph::profile::mirror {
require ::ceph::profile::client
$rbd_name = $::ceph::profile::params::rbd_mirror_client_name ? {
require ceph::profile::client
$rbd_name = $ceph::profile::params::rbd_mirror_client_name ? {
undef => 'openstack',
default => $::ceph::profile::params::rbd_mirror_client_name,
default => $ceph::profile::params::rbd_mirror_client_name,
}
ceph::mirror { $rbd_name:
}

View File

@ -21,7 +21,7 @@
# Profile for a Ceph mon
#
class ceph::profile::mon {
require ::ceph::profile::base
require ceph::profile::base
ceph::mon { $::hostname:
authentication_type => $ceph::profile::params::authentication_type,
@ -37,7 +37,7 @@ class ceph::profile::mon {
}
if !empty($ceph::profile::params::client_keys) {
class { '::ceph::keys':
class { 'ceph::keys':
args => $ceph::profile::params::client_keys,
defaults => $defaults
}

View File

@ -21,9 +21,9 @@
# Profile for a Ceph osd
#
class ceph::profile::osd {
require ::ceph::profile::client
require ceph::profile::client
class { '::ceph::osds':
class { 'ceph::osds':
args => $ceph::profile::params::osds,
}
}

View File

@ -20,15 +20,15 @@
# Profile for Ceph rgw
#
class ceph::profile::rgw {
require ::ceph::profile::base
$rgw_name = $::ceph::profile::params::rgw_name ? {
require ceph::profile::base
$rgw_name = $ceph::profile::params::rgw_name ? {
undef => 'radosgw.gateway',
default => $::ceph::profile::params::rgw_name,
default => $ceph::profile::params::rgw_name,
}
ceph::rgw { $rgw_name:
user => $::ceph::profile::params::rgw_user,
rgw_print_continue => $::ceph::profile::params::rgw_print_continue,
frontend_type => $::ceph::profile::params::frontend_type,
rgw_frontends => $::ceph::profile::params::rgw_frontends,
user => $ceph::profile::params::rgw_user,
rgw_print_continue => $ceph::profile::params::rgw_print_continue,
frontend_type => $ceph::profile::params::frontend_type,
rgw_frontends => $ceph::profile::params::rgw_frontends,
}
}

View File

@ -61,18 +61,18 @@
#
class ceph::repo (
$ensure = present,
$release = $::ceph::params::release,
$release = $ceph::params::release,
$fastcgi = false,
$proxy = undef,
$proxy_username = undef,
$proxy_password = undef,
$enable_epel = true,
$enable_sig = $::ceph::params::enable_sig,
$enable_sig = $ceph::params::enable_sig,
$ceph_mirror = undef,
) inherits ceph::params {
case $::osfamily {
'Debian': {
include ::apt
include apt
if $ceph_mirror {
$ceph_mirror_real = $ceph_mirror

View File

@ -72,17 +72,16 @@
# [*syslog*] Whether or not to log to syslog.
# Optional. Default is true.
#
define ceph::rgw (
$pkg_radosgw = $::ceph::params::pkg_radosgw,
$pkg_radosgw = $ceph::params::pkg_radosgw,
$rgw_ensure = 'running',
$rgw_enable = true,
$rgw_data = "/var/lib/ceph/radosgw/ceph-${name}",
$user = $::ceph::params::user_radosgw,
$user = $ceph::params::user_radosgw,
$keyring_path = "/etc/ceph/ceph.client.${name}.keyring",
$log_file = '/var/log/ceph/radosgw.log',
$rgw_dns_name = $::fqdn,
$rgw_socket_path = $::ceph::params::rgw_socket_path,
$rgw_socket_path = $ceph::params::rgw_socket_path,
$rgw_print_continue = false,
$rgw_port = undef,
$frontend_type = 'civetweb',
@ -91,7 +90,7 @@ define ceph::rgw (
$syslog = undef,
) {
include ::stdlib
include stdlib
if $syslog
{

View File

@ -80,7 +80,7 @@ define ceph::rgw::apache_proxy_fcgi (
$custom_apache_ports = undef,
) {
class { '::apache':
class { 'apache':
default_mods => $apache_mods,
default_vhost => $apache_vhost,
purge_configs => $apache_purge_configs,
@ -92,14 +92,14 @@ define ceph::rgw::apache_proxy_fcgi (
}
if !$apache_mods {
include ::apache::mod::auth_basic
include ::apache::mod::env
include apache::mod::auth_basic
include apache::mod::env
}
include ::apache::mod::alias
include ::apache::mod::mime
include ::apache::mod::rewrite
include ::apache::mod::proxy
::apache::mod { 'proxy_fcgi': }
include apache::mod::alias
include apache::mod::mime
include apache::mod::rewrite
include apache::mod::proxy
apache::mod { 'proxy_fcgi': }
apache::vhost { "${rgw_dns_name}-radosgw":
servername => $rgw_dns_name,

View File

@ -44,21 +44,20 @@
# Name of the keystone service used by RGW
# Defaults to 'swift::object-store'
#
class ceph::rgw::keystone::auth (
$password = $::ceph::profile::params::rgw_keystone_admin_password,
$user = $::ceph::profile::params::rgw_keystone_admin_user,
$password = $ceph::profile::params::rgw_keystone_admin_password,
$user = $ceph::profile::params::rgw_keystone_admin_user,
$email = 'rgwuser@localhost',
$roles = ['admin', 'Member'],
$public_url = 'http://127.0.0.1:8080/swift/v1',
$admin_url = 'http://127.0.0.1:8080/swift/v1',
$internal_url = 'http://127.0.0.1:8080/swift/v1',
$region = 'RegionOne',
$tenant = $::ceph::profile::params::rgw_keystone_admin_project,
$tenant = $ceph::profile::params::rgw_keystone_admin_project,
$rgw_service = 'swift::object-store',
) {
include ::openstacklib::openstackclient
include openstacklib::openstackclient
ensure_resource('keystone_service', 'swift::object-store', {
'ensure' => 'present',

View File

@ -20,7 +20,7 @@ require 'spec_helper'
describe 'ceph::key' do
let (:pre_condition) do
"class { '::ceph': fsid => 'foo' }"
"class { 'ceph': fsid => 'foo' }"
end
shared_examples 'ceph key' do