Make the 'Could not find data item hacluster_pwd' error a bit clearer

If you deploy a role with a pacemaker-managed service (galera, rabbit, redis,
etc) but forgot to add the ::tripleo::profile::base::pacemaker
there will be a rather unintuitive error:
  puppet apply --debug --verbose --detailed-exitcodes --summarize --color=false --modulepath
    /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/module --tags
    file,file_line,concat,augeas,pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation
    -e 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::database::redis_bundle'",
  Error: Evaluation Error: Error while evaluating a Function
  Call, Could not find data item hacluster_pwd in any Hiera data file and no default supplied at
  /etc/puppet/modules/tripleo/manifests/profile/base/pacemaker.pp:127:24 on node role-2.localdomain

Let's make it a bit clearer. Long-term we want to look at a validation
that covers this.

Change-Id: Iffb6e76cdd0286ef10ada57c70ce31971e42c84f
This commit is contained in:
Michele Baldessari 2018-03-19 19:05:58 +01:00
parent 23a311f6ca
commit 77527bb050
1 changed files with 4 additions and 0 deletions

View File

@ -90,6 +90,10 @@ class tripleo::profile::base::pacemaker (
fail("Count of ${remote_short_node_names} is not equal to count of ${remote_node_ips}")
}
if hiera('hacluster_pwd', undef) == undef {
fail("The 'hacluster_pwd' hiera key is undefined, did you forget to include ::tripleo::profile::base::pacemaker in your role?")
}
Pcmk_resource <| |> {
tries => 10,
try_sleep => 3,