Fix dashboard_{user,group} Variables

The dashboard_user and dashboard_group variables correspond to
both the system puppet-dashboard user and group as well as the
MySQL puppet-dashboard user. This commit fixes where I was using
the non-validated variable as well as adds documentation.
This commit is contained in:
Gary Larizza
2011-06-20 11:19:22 -07:00
parent b3572238a0
commit 0552073ddf
3 changed files with 18 additions and 11 deletions

View File

@@ -12,7 +12,8 @@ To install the Puppet Dashboard and configure it with sane defaults, include the
class {'dashboard': class {'dashboard':
dashboard_ensure => 'present', dashboard_ensure => 'present',
dashboard_user => 'dashboard', dashboard_user => 'puppet-dashboard',
dashboard_group => 'puppet-dashboard',
dashboard_password => 'changeme', dashboard_password => 'changeme',
dashboard_db => 'dashboard_db', dashboard_db => 'dashboard_db',
dashboard_charset => 'utf8', dashboard_charset => 'utf8',

View File

@@ -5,7 +5,9 @@
# Parameters: # Parameters:
# [*dashboard_ensure*] - The value of the ensure parameter for the # [*dashboard_ensure*] - The value of the ensure parameter for the
# puppet-dashboard package. # puppet-dashboard package.
# [*dashboard_user*] - Name of the puppet-dashboard database user. # [*dashboard_user*] - Name of the puppet-dashboard database and
# system user.
# [*dashboard_group*] - Name of the puppet-dashboard group.
# [*dashbaord_password*] - Password for the puppet-dashboard database user. # [*dashbaord_password*] - Password for the puppet-dashboard database user.
# [*dashboard_db*] - The puppet-dashboard database name. # [*dashboard_db*] - The puppet-dashboard database name.
# [*dashboard_charset*] - Character set for the puppet-dashboard database. # [*dashboard_charset*] - Character set for the puppet-dashboard database.
@@ -37,6 +39,7 @@
class dashboard ( class dashboard (
$dashboard_ensure = $dashboard::params::dashboard_ensure, $dashboard_ensure = $dashboard::params::dashboard_ensure,
$dashboard_user = $dashboard::params::dashboard_user, $dashboard_user = $dashboard::params::dashboard_user,
$dashboard_group = $dashboard::params::dashboard_group,
$dashboard_password = $dashboard::params::dashboard_password, $dashboard_password = $dashboard::params::dashboard_password,
$dashboard_db = $dashboard::params::dashboard_db, $dashboard_db = $dashboard::params::dashboard_db,
$dashboard_charset = $dashboard::params::dashboard_charset $dashboard_charset = $dashboard::params::dashboard_charset
@@ -48,6 +51,7 @@ class dashboard (
$v_bool = [ '^true$', '^false$' ] $v_bool = [ '^true$', '^false$' ]
validate_re($dashboard_ensure, $v_alphanum) validate_re($dashboard_ensure, $v_alphanum)
validate_re($dashboard_user, $v_alphanum) validate_re($dashboard_user, $v_alphanum)
validate_re($dashboard_group, $v_alphanum)
validate_re($dashboard_password, $v_alphanum) validate_re($dashboard_password, $v_alphanum)
validate_re($dashboard_db, $v_alphanum) validate_re($dashboard_db, $v_alphanum)
validate_re($dashboard_charset, $v_alphanum) validate_re($dashboard_charset, $v_alphanum)
@@ -55,6 +59,7 @@ class dashboard (
$dashboard_ensure_real = $dashboard_ensure $dashboard_ensure_real = $dashboard_ensure
$dashboard_user_real = $dashboard_user $dashboard_user_real = $dashboard_user
$dashboard_group_real = $dashboard_group
$dashboard_password_real = $dashboard_password $dashboard_password_real = $dashboard_password
$dashboard_db_real = $dashboard_db $dashboard_db_real = $dashboard_db
$dashboard_charset_real = $dashboard_charset $dashboard_charset_real = $dashboard_charset
@@ -75,23 +80,23 @@ class dashboard (
ensure => present, ensure => present,
content => template('dashboard/database.yml.erb'), content => template('dashboard/database.yml.erb'),
mode => '0755', mode => '0755',
owner => $dashboard_user, owner => $dashboard_user_real,
group => $dashboard_group, group => $dashboard_group_real,
} }
file { "${dashboard::params::dashboard_root}/config/database.yml": file { "${dashboard::params::dashboard_root}/config/database.yml":
ensure => 'link', ensure => 'link',
target => '/etc/puppet-dashboard/database.yml', target => '/etc/puppet-dashboard/database.yml',
mode => '0755', mode => '0755',
owner => $dashboard_user, owner => $dashboard_user_real,
group => $dashboard_group, group => $dashboard_group_real,
} }
file { [ "${dashboard::params::dashboard_root}/public", "${dashboard::params::dashboard_root}/public/stylesheets", "${dashboard::params::dashboard_root}/public/javascript", "${dashboard::params::dashboard_root}/tmp", '/etc/puppet-dashboard' ]: file { [ "${dashboard::params::dashboard_root}/public", "${dashboard::params::dashboard_root}/public/stylesheets", "${dashboard::params::dashboard_root}/public/javascript", "${dashboard::params::dashboard_root}/tmp", '/etc/puppet-dashboard' ]:
ensure => directory, ensure => directory,
mode => '0755', mode => '0755',
owner => $dashboard_user, owner => $dashboard_user_real,
group => $dashboard_group, group => $dashboard_group_real,
recurse => true, recurse => true,
recurselimit => '1', recurselimit => '1',
require => Package[$dashboard_package], require => Package[$dashboard_package],
@@ -101,8 +106,8 @@ class dashboard (
file { "${dashboard::params::dashboard_root}/log/production.log": file { "${dashboard::params::dashboard_root}/log/production.log":
ensure => file, ensure => file,
mode => '0644', mode => '0644',
owner => $dashboard_user, owner => $dashboard_user_real,
group => $dashboard_group, group => $dashboard_group_real,
} }
file { '/etc/logrotate.d/puppet-dashboard': file { '/etc/logrotate.d/puppet-dashboard':
@@ -128,9 +133,9 @@ class dashboard (
} }
mysql::db { "${dashboard_db_real}": mysql::db { "${dashboard_db_real}":
user => $dashboard_user,
password => $dashboard_password, password => $dashboard_password,
charset => $dashboard_charset, charset => $dashboard_charset,
user => $dashboard_user_real,
} }
# The UID and GID are taken from the puppet-dashboard package, # The UID and GID are taken from the puppet-dashboard package,

View File

@@ -3,6 +3,7 @@ node default {
class {'dashboard': class {'dashboard':
dashboard_ensure => 'present', dashboard_ensure => 'present',
dashboard_user => 'puppet-dashboard', dashboard_user => 'puppet-dashboard',
dashboard_group => 'puppet-dashboard',
dashboard_password => 'changeme', dashboard_password => 'changeme',
dashboard_db => 'dashboard_production', dashboard_db => 'dashboard_production',
dashboard_charset => 'utf8' dashboard_charset => 'utf8'