voxpupuli / puppet-snmp

Puppet module to manage Net-SNMP.
https://forge.puppet.com/puppet/snmp
Apache License 2.0
35 stars 131 forks source link

snmpd_options parameter does not work with Debian 9 #110

Closed brigriffin closed 4 years ago

brigriffin commented 7 years ago

The snmpd_options parameter of this module does not work anymore with Debian 9 (stretch). It looks like modifying the SNMPDOPTS environment variable directly in the /etc/defaults/snmpd file as does this module actually do is not taken in account anymore. Since Debian 9 uses systemd, the default SNMP daemon options are set in /lib/systemd/system/snmpd.service (in the ExecStart parameter). So starting from Debian 9 I think this module needs to use the systemd way in order to customise snmpd's options.

alaunay commented 6 years ago

That is correct... Here we added a workaround, but it would be nice to see the logic directly into the module:

  case $::lsbdistcodename {
    'stretch': {
      augeas { 'systemd-snmpd-conf':
        context => '/files/lib/systemd/system/snmpd.service/Service/ExecStart',
        changes => [
          'set arguments/1 -LS2d',
        ],
        require => Package['snmpd'],
        notify  => [ Exec['systemd-reload'], Service['snmpd'], ],
      }
      exec { 'systemd-reload':
        command     => '/bin/systemctl daemon-reload',
         refreshonly => true,
      }
    }
    default: { }
  }

With the exec due to systemd being unable to read system conf files directly, as it seems.

hdep commented 5 years ago

Hi,

I have the same issue. @bastelfreak is there any work in progress on this issue ?

Maybe the fastest way to fix this is to provide for debian 9 a template for /lib/systemd/system/snmpd.service ?

bastelfreak commented 5 years ago

@hdep can you provide a patch for this? Also the preferred way custom systemd unit files is /etc/systemd/system/ and not /lib/systemd/system.

Dan33l commented 5 years ago

Since this module is declared Debian9 compatible and with acceptance tests, they should fail. But they pass.

@hep with your patch can you update acceptance tests to tackle this issue ?

hdep commented 5 years ago

@bastelfreak on debian 9 the file in /etc/systemd is a link to /lib/systemd

$ ls -al /etc/systemd/system/multi-user.target.wants/snmpd.service
lrwxrwxrwx 1 root root 33 janv.  4 10:02 /etc/systemd/system/multi-user.target.wants/snmpd.service -> /lib/systemd/system/snmpd.service

So I can't do that

hdep commented 5 years ago

I give up because I think fixing rpsec should have been done in another PR. if anyone can fix the bug this will be great.

hdep commented 4 years ago

bug still present in 5.0.0

hdep commented 4 years ago

fixed in #216