Skip to content

Commit

Permalink
Merge pull request redhat-openstack#162 from cwolferh/master
Browse files Browse the repository at this point in the history
Update repo locations for pacemaker and galera
  • Loading branch information
strider committed Dec 5, 2014
2 parents f05fce5 + a827f05 commit c64de9b
Show file tree
Hide file tree
Showing 75 changed files with 7,922 additions and 101 deletions.
8 changes: 4 additions & 4 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ mod 'firewall',
:git => 'https://github.com/puppetlabs/puppetlabs-firewall.git'

mod 'galera',
:commit => 'f7d4110886b643eb63dc5c347a0e8a06b09642e7',
:git => 'https://github.com/rohara/puppet-galera.git'
:commit => '061799ec2dbf1527d2bc556cac7c4d85fea106cc',
:git => 'https://github.com/redhat-openstack/puppet-galera.git'

mod 'glance',
:commit => '24d5c3425f6016e9eb6447a4041a7419eada3d31',
Expand Down Expand Up @@ -111,8 +111,8 @@ mod 'openstacklib',
:git => 'https://github.com/stackforge/puppet-openstacklib.git'

mod 'pacemaker',
:commit => '0ed9ee8a29c0f27e86727d415b39d2715332df7d',
:git => 'https://github.com/radez/puppet-pacemaker.git'
:commit => '52acfd9c31e0801cedf970929851d4bece5cf79b',
:git => 'https://github.com/redhat-openstack/puppet-pacemaker.git'

mod 'puppet',
:commit => 'bd467cae15eba9ca44274034d2593b0eaf30518d',
Expand Down
4 changes: 2 additions & 2 deletions galera/.fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib"
"xinetd": "git://github.com/packstack/puppetlabs-xinetd"
"mysql": "git://github.com/packstack/puppetlabs-mysql"
"xinetd": "git://github.com/puppetlabs/puppetlabs-xinetd"
"mysql": "git://github.com/puppetlabs/puppetlabs-mysql"
symlinks:
"galera": "#{source_dir}"
3 changes: 2 additions & 1 deletion galera/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Gemfile.lock
.vagrant
vendor
vendor/
.bundle/
spec/fixtures/modules
spec/fixtures/manifests/site.pp
12 changes: 5 additions & 7 deletions galera/Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
source 'https://rubygems.org'

group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-system', :require => false
gem 'rspec-system-puppet', :require => false
gem 'rspec-system-serverspec', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
gem 'puppet-lint-param-docs', '1.1.0'
gem 'puppet-syntax'
gem 'rake', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
27 changes: 26 additions & 1 deletion galera/Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'rspec-system/rake_task'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'

exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]

PuppetSyntax.exclude_paths = exclude_paths

Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
config.ignore_paths = exclude_paths
config.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
config.disable_checks = [ "class_inherits_from_params_class", "80chars" ]
config.fail_on_warnings = true
config.relative = true
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
]
52 changes: 38 additions & 14 deletions galera/manifests/monitor.pp
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
# Class galera::monitor
# == Class: galera::monitor
#
# Parameters:
# [*mysql_username*] - Username of the service account used for the clustercheck script.
# [*mysql_password*] - Password of the service account used for the clustercheck script.
# [*mysql_host*] - Hostname/IP address of mysql server to monitor. Defaults to 127.0.0.1.
# [*mysql_port] - Port used by mysql service. Defaults to 3306.
# [*monitor_port*] - Port used by galera monitor service. Defaults to 9200.
# [*monitor_script*] - Full path to monitor script. Defaults to '/usr/bin/clustercheck'.
# [*enabled*] - Enable/Disable galera monitor xinetd::service. Defaults to true.
# === Parameters:
#
# Actions:
# [*mysql_username*]
# Username of the service account used for the clustercheck script.
#
# Requires:
# [*mysql_password*]
# Password of the service account used for the clustercheck script.
#
# [*mysql_host*]
# Hostname/IP address of mysql server to monitor.
# Defaults to 127.0.0.1.
#
# [*mysql_port*]
# Port used by mysql service.
# Defaults to 3306.
#
# [*monitor_port*]
# Port used by galera monitor service.
# Defaults to 9200.
#
# [*monitor_script*]
# Full path to monitor script.\
# Defaults to '/usr/bin/clustercheck'.
#
# [*enabled*]
# Enable/Disable galera monitor xinetd::service.
# Defaults to true.
#
# [*create_mysql_user*]
# Whether to create mysql user or not.
# Defaults to false.
#
# === Actions:
#
# === Requires:
#
# === Sample usage:
#
# Sample usage:
# class { 'galera::monitor':
# mysql_username => 'mon_user',
# mysql_password => 'mon_pass'
Expand All @@ -38,7 +62,7 @@

file { '/etc/sysconfig/clustercheck':
mode => '0640',
content => template("galera/clustercheck.erb"),
content => template('galera/clustercheck.erb'),
owner => 'root',
group => 'root',
}
Expand All @@ -58,7 +82,7 @@

if $create_mysql_user {
mysql_user { "${mysql_username}@${mysql_host}":
ensure => present,
ensure => present,
password_hash => mysql_password($mysql_password),
require => [File['/root/.my.cnf'],Service['galera']],
}
Expand Down
104 changes: 73 additions & 31 deletions galera/manifests/server.pp
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
# Class: galera::server
# == Class: galera::server
#
# manages the installation of the galera server.
# manages the package, service, galera.cnf
#
# Parameters:
# [*msyql_server_hash*] - Hash of mysql server parameters.
# [*bootstrap*] - Defaults to false, boolean to set cluster boostrap.
# [*package_name*] - The name of the galera package.
# [*package_ensure*] - Ensure state for package. Can be specified as version.
# [*service_name*] - The name of the galera service.
# [*service_enable*] - Defaults to true, boolean to set service enable.
# [*service_ensure*] - Defaults to running, needed to set root password.
# [*service_provider*] - What service provider to use.
# [*wsrep_bind_address*] - Address to bind galera service.
# [*wsrep_node_address*] - Address of local galera node.
# [*wsrep_provider*] - Full path to wsrep provider library or 'none'.
# [*wsrep_cluster_name*] - Logical cluster name. Should be the same for all nodes.
# [*wsrep_cluster_members*] - List of cluster members, IP addresses or hostnames.
# [*wsrep_sst_method*] - State snapshot transfer method.
# [*wsrep_sst_username*] - Username used by the wsrep_sst_auth authentication string.
# [*wsrep_sst_password*] - Password used by the wsrep_sst_auth authentication string.
# [*wsrep_ssl*] - Boolean to disable SSL even if certificate and key are configured.
# [*wsrep_ssl_key*] - Private key for the certificate above, unencrypted, in PEM format.
# [*wsrep_ssl_cert*] - Certificate file in PEM format.
#
# Actions:
#
# Requires:
#
# Sample Usage:
# === Parameters:
#
# [*mysql_server_hash*]
# Hash of mysql server parameters.
#
# [*bootstrap*]
# Defaults to false, boolean to set cluster boostrap.
#
# [*package_name*]
# The name of the galera package.
#
# [*package_ensure*]
# Ensure state for package. Can be specified as version.
#
# [*service_name*]
# The name of the galera service.
#
# [*service_enable*]
# Defaults to true, boolean to set service enable.
#
# [*service_ensure*]
# Defaults to running, needed to set root password.
#
# [*service_provider*]
# What service provider to use.
#
# [*wsrep_bind_address*]
# Address to bind galera service.
#
# [*wsrep_node_address*]
# Address of local galera node.
#
# [*wsrep_provider*]
# Full path to wsrep provider library or 'none'.
#
# [*wsrep_cluster_name*]
# Logical cluster name. be the same for all nodes.
#
# [*wsrep_cluster_members*]
# List of cluster members, IP addresses or hostnames.
#
# [*wsrep_sst_method*]
# State snapshot transfer method.
#
# [*wsrep_sst_username*]
# Username used by the wsrep_sst_auth authentication string.
#
# [*wsrep_sst_password*]
# Password used by the wsrep_sst_auth authentication string.
#
# [*wsrep_ssl*]
# Boolean to disable SSL even if certificate and key are configured.
#
# [*wsrep_ssl_key*]
# Private key for the certificate above, unencrypted, in PEM format.
#
# [*wsrep_ssl_cert*]
# Certificate file in PEM format.
#
# [*debug*]
#
# [*manage_service*]
# State of the service.
#
# === Actions:
#
# === Requires:
#
# === Sample Usage:
# class { 'galera::server':
# config_hash => {
# bind_address => '0.0.0.0',
Expand Down Expand Up @@ -85,10 +128,9 @@

if $manage_service {
service { 'galera':
name => $service_name,
name => 'mysqld', # short-term hack to see if it works
enable => $service_enable,
ensure => $service_ensure,
ensure => $service_ensure,
name => $service_name,
enable => $service_enable,
}
}
}
84 changes: 68 additions & 16 deletions galera/spec/classes/galera_monitor_spec.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,81 @@
require 'spec_helper'
describe 'galera::monitor' do

let :facts do
{ :osfamily => 'RedHat' }
end
let :pre_condition do
"include 'galera::server'"
end

let :params do
{
:monitor_username => 'monitor_user',
:monitor_password => 'monitor_pass',
:monitor_hostname => '127.0.0.1',
:mysql_port => '3306',
:mysql_path => '/usr/bin/mysql',
:script_dir => '/usr/local/bin',
:enabled => true
:mysql_username => 'monitor_user',
:mysql_password => 'monitor_pass',
:mysql_host => '127.0.0.1',
:mysql_port => '3306',
:monitor_port => '9200',
:monitor_script => '/usr/bin/clustercheck',
:enabled => true,
:create_mysql_user => false,
}
end

it { should contain_service('xinetd').with(
:ensure => 'running',
:enable => 'true'
)}
context 'with galera-monitor xinetd service' do
context 'with enabled parameter to true' do
it 'Configures galera-monitor xinetd service' do
should contain_xinetd__service('galera-monitor').with(
:disable => 'no',
:port => '9200',
:server => '/usr/bin/clustercheck',
:flags => 'REUSE',
:per_source => 'UNLIMITED',
:service_type => 'UNLISTED',
:log_on_success => '',
:log_on_success_operator => '=',
:log_on_failure => 'HOST',
:log_on_failure_operator => '=',
)
end
end

context 'with enabled parameter to false' do
let(:params) { {:enabled => false } }
it 'Configures galera-monitor xinetd service' do
should contain_xinetd__service('galera-monitor').with(
:disable => 'yes',
:port => '9200',
:server => '/usr/bin/clustercheck',
:flags => 'REUSE',
:per_source => 'UNLIMITED',
:service_type => 'UNLISTED',
:log_on_success => '',
:log_on_success_operator => '=',
:log_on_failure => 'HOST',
:log_on_failure_operator => '=',
)
end
end
end

it 'Configures clustercheck configuration file' do
should contain_file('/etc/sysconfig/clustercheck').with(
:mode => '0640',
:owner => 'root',
:group => 'root',
)
end

it { should contain_file('/usr/local/bin/galera_chk')}
it { should contain_database_user("[email protected]")}
context 'with create_mysql_user parameter' do
let(:params) { {:create_mysql_user => false} }
context 'create_mysql_user to false' do
it 'Should not contain mysql_user resource' do
should_not contain_mysql_user()
end
end

let(:params) { {:create_mysql_user => true} }
context 'create_mysql_user to true' do
it 'Should contain mysql_user resource' do
should contain_mysql_user("[email protected]")
end
end
end
end
Loading

0 comments on commit c64de9b

Please sign in to comment.