voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.
https://forge.puppet.com/puppet/zabbix
Apache License 2.0
79 stars 229 forks source link

Support multiple values in TLSAccept #947

Closed wolfaba closed 1 month ago

wolfaba commented 1 month ago

Pull Request (PR) description

Option TLSAccept in zabbix_agentd.conf accepts list of values separated with comma. But the module define tlsaccept as Enum of those three values. The string as comma separated list of values is not allowed anymore. Therefore the tlsaccept should be array of that enum and in the template the array should be joined with comma.

BTW: the same option TLSAccept is in zabbix_proxy.conf, but in the module the tlsaccept in proxy.pp is still simple string value.

Thank you.

wolfaba commented 1 month ago

I am sorry for so many commits. I am neither ruby nor puppet developer :disappointed: If you understand, what I mean, could you please fix the "if"? I need join array values or just insert single string (Enum) value. Thank you.

wolfaba commented 1 month ago

Hi Robert, can you add the same datatype to the tlsaccept on the proxy?

Hello @Valantin, I hope it's correct.

Valantin commented 1 month ago

ok, now I can you add spec test for the classes?

for agent exist it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^TLSAccept=cert$} } You can try to add two test, using tlsaccept => ['cert'] and one using a two element array. the first one is for check it work in the some way with string and array with one element and the second for check it costruct correctly the string with an array of two or more. For proxy not exist the spec, probably you can reuse the one from the agent

 context 'configuration file with full options' do
    if facts[:kernel] == 'Linux'
      let :params { tlsaccept: ['cert'] }
      it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^TLSAccept=cert$} }
    end
 end
Valantin commented 1 month ago

@wolfaba can you squash in one commit with good message?

wolfaba commented 1 month ago

@Valantin is it better now? I hope I haven't broke it :grimacing: