puppet-snmp icon indicating copy to clipboard operation
puppet-snmp copied to clipboard

WIP: Simpify traditional access control parameters

Open alexjfisher opened this issue 6 years ago • 4 comments
trafficstars

Instead of allowing undef, plain strings or arrays of strings, just allow arrays of strings. Parameters that previously defaulted to undef now default to empty arrays.

This allows us to simplify the templates and we no longer have Optional parameters that have default values set. (ro_community defaulting to 'public' but allowing undef didn't make much sense previously.)

View-based Access Control Model (VACM) is still recommended, but traditional access control is no longer deprecated.

Pull Request (PR) description

This Pull Request (PR) fixes the following issues

alexjfisher avatar Feb 23 '19 18:02 alexjfisher

I do not think we should encourage the use of empty data sets like '', [] and {} and should instead use undef.

Empty string I agree with, but [] and {} I think are often preferable to undef and this pattern is extremely popular. In this case in particular, where we are defaulting to a value, allowing undef doesn't make sense. I also don't like multiple ways of expressing no traditional access control communities. The acceptance tests already use empty arrays and not undef. https://github.com/voxpupuli/puppet-snmp/blob/a27f22dbf771cde6de511f773e9996e5de5f4a0b/spec/acceptance/snmp_spec.rb#L36

alexjfisher avatar Feb 24 '19 22:02 alexjfisher

The acceptance tests already use empty arrays and not undef.

Oups my fault.

Dan33l avatar Feb 25 '19 13:02 Dan33l

I do not think we should encourage the use of empty data sets like '', [] and {} and should instead use undef.

From our review guidelines:

Are there new params with datatype Hash or Array? If possible, they should default to empty Hash/Array instead of undef. You can also enforce the datastructure like Array[String]

bastelfreak avatar Feb 26 '19 21:02 bastelfreak

Dear @alexjfisher, thanks for the PR!

This is Vox Pupuli Tasks, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

vox-pupuli-tasks[bot] avatar Sep 30 '20 23:09 vox-pupuli-tasks[bot]