From f9e154d36aee29960d5ebe88cd8022cbddc3d203 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 6 Mar 2014 13:14:39 -0300 Subject: Fail on empty variables --- manifests/bootstrap/configurator.pp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/bootstrap/configurator.pp b/manifests/bootstrap/configurator.pp index 18175a3..d93a0ce 100644 --- a/manifests/bootstrap/configurator.pp +++ b/manifests/bootstrap/configurator.pp @@ -15,16 +15,40 @@ $templates = "$bootstrap_path/templates" $base_domain = hiera('bootstrap::base_domain', "${::domain}") $first_hostname = hiera('bootstrap::first_hostname', "${::hostname}") $first_nodes = hiera('bootstrap::first_nodes', 'absent') -$db_password = hiera('nodo::role::master::db_password', 'changeme') +$db_password = hiera('nodo::role::master::db_password', '') $mysql_rootpw = hiera('mysql::server::rootpw', '') -$root_password = hiera('bootstrap::root:password', 'rootpass') +$root_password = hiera('bootstrap::root::password', '') $first_user = hiera('bootstrap::first_user', 'user') -$first_user_password = hiera('bootstrap::first_user::password', 'userpass') -$first_user_sshkey = hiera('bootstrap::first_user::sshkey', 'usersshkey') -$first_user_email = hiera('bootstrap::first_user::email', 'usermail') +$first_user_password = hiera('bootstrap::first_user::password', '') +$first_user_sshkey = hiera('bootstrap::first_user::sshkey', '') +$first_user_email = hiera('bootstrap::first_user::email', 'user@example.org') $resolvconf_nameservers = hiera('nodo::subsystem::resolver::nameservers', '201.6.2.152:201.6.2.32') $global_munin_allow = hiera('nodo::munin_node::allow', '192.168.0.[0-9]*') +# +# Check bootstrap configuration +# + +if ($mysql_rootpw == '') { + alert('You must set mysql::server::rootpw at your configuration') + fail() +} + +if ($db_password == '') { + alert('You must set nodo::role::master::db_password at your configuration') + fail() +} + +if ($root_password == '') { + alert('You must set bootstrap::root::password at your configuration') + fail() +} + +if ($first_user_password == '') { + alert('You must set bootstrap::first_user::password at your configuration') + fail() +} + # # Puppet configuration # -- cgit v1.2.3