voxpupuli/puppet-corosync

Dependency problem when enabling secauth and disabling service management

Closed this issue · 1 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.6
  • Ruby: 2.4.4p296
  • Distribution: Ubuntu bionic
  • Module version: 6.0.1

How to reproduce (e.g Puppet code you use)

class { 'corosync':
    authkey                  => '/etc/foobar_corosync_authkey',
    bind_address             => $bind_address,
    unicast_addresses        => $unicast_addresses,
    cluster_name             => $cluster_name,
    enable_secauth           => true,
    set_votequorum           => true,
    quorum_members           => $quorum_members,
    token                    => 60000,
    enable_corosync_service  => false,
    enable_pacemaker_service => false,
    manage_corosync_service  => false,
    manage_pacemaker_service => false,
}

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Service[corosync]' in parameter 'notify' (file: /etc/puppetlabs/code/environments/production/modules/corosync/manifests/init.pp, line: 423) on node XXXXXXX

What behaviour did you expect instead

A clean run (no error)

Output log

see above

Any additional information you'd like to impart

The error origins in dependencies. Problem is that the service as well as secauth (where the notify comes from) are optional, so it wouldn't help to subscribe from the service instead of notifying from the file. I think the only solution is a "if" statement and having the file resources twice, one with the notify, the other without.

This section in init.pp is also problematic in that sense:

        augeas { 'enable corosync':
          lens    => 'Shellvars.lns',
          incl    => '/etc/default/corosync',
          context => '/files/etc/default/corosync',
          changes => [
            'set START "yes"',
          ],
          require => $corosync_package_require,
          before  => Service['corosync'],
        }