example42 / puppet-tp

Tiny Puppet - The Universal Installer
http://tiny-puppet.com
Apache License 2.0
68 stars 21 forks source link

config_file_notify #62

Closed dagobert closed 5 years ago

dagobert commented 5 years ago

I am using the followin setup

  tp::conf { 'samba::shares.conf':
    config_file_notify  => "Exec['samba_reload_config']",
    source =>"puppet:///modules/mybase/samba/shares.conf.${facts['hostname']}",
  }
  # Reload Samba instead of restarting the service
  exec { 'samba_reload_config':
    command => '/usr/bin/smbcontrol all reload-config',
    refreshonly => true,
    require => [ Tp::Install['samba'], ],
    onlyif => '/usr/bin/test -f /etc/samba/.samba_has_joined',
  }

When running puppet agent I get the following error:

Server Error: Could not find resource 'Exec['samba_reload_config']' in parameter 'notify' (file: /etc/puppetlabs/code/environments/testing/modules/tp/manifests/conf.pp, line: 338)

My module list

── example42-dhcpd (v2.0.16)
├── example42-firewall (v2.1.3)
├── example42-iptables (v2.1.15)
├── example42-logrotate (v2.0.19)
├── example42-monit (v2.0.18)
├── example42-monitor (v2.0.4)
├── example42-mysql (v2.1.8)
├── example42-network (v3.5.0)
├── example42-nrpe (v2.0.18)
├── example42-ntp (v2.0.16)
├── example42-openssh (v2.0.11)
├── example42-postfix (v2.0.22)
├── example42-puppi (v2.2.6)
├── example42-rsyslog (v2.0.15)
├── example42-snmpd (v2.0.16)
├── example42-timezone (v2.0.16)
├── example42-tinydata (v0.3.1)
├── example42-tp (v2.3.1)
alvagante commented 5 years ago

I think there's some issue with quotes. Try: config_file_notify => Exec['samba_reload_config'], or: config_file_notify => 'Exec[samba_reload_config]', or config_file_notify => Exec[samba_reload_config],

Also, as workaorund, you might try to use directly the notify metaparameter and remove config_file_notify: notify => Exec['samba_reload_config'],

Pls, let me know if any of these works

dagobert commented 5 years ago

I think there's some issue with quotes. Try: config_file_notify => Exec['samba_reload_config'],

SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Tp::Conf[samba]: parameter 'config_file_notify' expects a value of type Boolean or String, got Type[Resource]

or: config_file_notify => 'Exec[samba_reload_config]',

No error and tested. This works.

or config_file_notify => Exec[samba_reload_config],

Server Error: Evaluation Error: Error while evaluating a Resource Statement, Tp::Conf[samba]: parameter 'config_file_notify' expects a value of type Boolean or String, got Type[Resource]

Also, as workaorund, you might try to use directly the notify metaparameter and remove config_file_notify: notify => Exec['samba_reload_config'],

I was using this in the meantime.

Will send a PR.