voxpupuli / puppet-windows_firewall

puppet module for configuring the windows firewall
https://forge.puppet.com/puppet/windows_firewall
MIT License
16 stars 55 forks source link

display_name does not default to resource name on version 2.0.0 #70

Open peterbuniq opened 6 years ago

peterbuniq commented 6 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

windows_firewall::exception { "510 allow http in ${label}":
  ensure       => present,
  direction    => 'in',
  action       => 'Allow',
  enabled      => 'yes',
  protocol     => "${settings['protocol']}",
  local_port   => "${settings['port']}",
  remote_port  => 'any',
  description  => 'Allow inbound http',
}

What are you seeing

Error at line 184 in the windows_firewall module. Duplicate declaration - Exec[set rule ]

What behaviour did you expect instead

display_name to be set from the resource title, as per the module documentation.

Output log

Any additional information you'd like to impart

jmchenra commented 5 years ago

Same for 2.0.1.

decibelhertz commented 5 years ago

Also on 2.0.2.

Default value should probably be $name or $title at https://github.com/voxpupuli/puppet-windows_firewall/blob/master/manifests/exception.pp#L89

decibelhertz commented 5 years ago

By way of example, here is what I am having to do as a result of this. Ideally, the resource name would not need to be duplicated into the $display_name variable.

profile::firewall::win_ipv4_firewalls:
  'Netmon ICMPv4-in':
    display_name: 'Netmon ICMPv4-in'
    description: 'Allow in Internet Control Message Protocol from Netmon IPs'
    protocol: ICMPv4
    remote_ip: &NMs '192.168.0.1,192.168.1.1'
  'Netmon NTP-in':
    display_name: 'Netmon NTP-in'
    description: 'Allow in Network Time Protocol from Netmon IPs'
    local_port: 123
    protocol: UDP
    remote_ip: *NMs
    remote_port: any
  'Netmon SNMP-in':
    display_name: 'Netmon SNMP-in'
    description: 'Allow in Simple Network Managment Protocol from Netmon IPs'
    local_port: 161
    protocol: UDP
    remote_ip: *NMs
    remote_port: any
TomG83 commented 4 years ago

Also using 2.0.2 with issue still there. I also use same workaround by duplicating resource name to display_name, but if you have dozen+ of rules, it's prone to human errors.