Skip to content

Commit

Permalink
Merge pull request #300 from jcpunk/puppet-lint
Browse files Browse the repository at this point in the history
Adjust for puppet-lint
  • Loading branch information
ghoneycutt authored Sep 14, 2020
2 parents 4dc687c + 0767bf9 commit 739727e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
1 change: 0 additions & 1 deletion examples/test.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class { 'firewalld':
log_denied => 'multicast',
}
Expand Down
5 changes: 1 addition & 4 deletions functions/safe_filename.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ function firewalld::safe_filename(
'replacement_string' => Pattern[/^[\w-]+$/],
'file_extension' => Optional[String[1]]
}
] $options = { 'replacement_string' => '_'}
] $options = { 'replacement_string' => '_' }
) {

$_badchar_regex = '[^\w-]'

# If we have an extension defined
if $options['file_extension'] {

# See if the string ends with the extension
$_extension_length = length($options['file_extension'])
if $filename[-($_extension_length), -1] == $options['file_extension'] {

# And extract the base filename
$_basename = $filename[0, -($_extension_length) - 1]
}
Expand Down
21 changes: 10 additions & 11 deletions manifests/custom_service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,21 @@
Optional[Array[Hash]] $port = undef,
Optional[Array[String]] $module = undef,
Optional[Hash[
Enum['ipv4', 'ipv6'],
String
Enum['ipv4', 'ipv6'],
String
]] $destination = undef,
String $filename = $short,
Stdlib::Unixpath $config_dir = '/etc/firewalld/services',
Enum['present','absent'] $ensure = 'present',
) {

$_args = delete_undef_values({
'ensure' => $ensure,
'short' => $short,
'description' => $description,
'ports' => $port,
'modules' => $module,
'ipv4_destination' => $destination.dig('ipv4'),
'ipv6_destination' => $destination.dig('ipv6'),
$_args = delete_undef_values( {
'ensure' => $ensure,
'short' => $short,
'description' => $description,
'ports' => $port,
'modules' => $module,
'ipv4_destination' => $destination.dig('ipv4'),
'ipv6_destination' => $destination.dig('ipv6'),
})

$_safe_filename = firewalld::safe_filename($filename)
Expand Down
6 changes: 2 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
Optional[String] $default_port_zone = undef,
Optional[String] $default_port_protocol = undef,
) {

include firewalld::reload
include firewalld::reload::complete

Expand Down Expand Up @@ -228,9 +227,8 @@
}

if $facts['firewalld_version'] and
(versioncmp($facts['firewalld_version'], '0.6.0') >= 0) and
$firewall_backend
{
(versioncmp($facts['firewalld_version'], '0.6.0') >= 0) and
$firewall_backend {
augeas {
'firewalld::firewall_backend':
changes => [
Expand Down
4 changes: 2 additions & 2 deletions manifests/reload.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class firewalld::reload {
assert_private()

exec{ 'firewalld::reload':
path =>'/usr/bin:/bin',
exec { 'firewalld::reload':
path => '/usr/bin:/bin',
command => 'firewall-cmd --reload',
onlyif => 'firewall-cmd --state',
refreshonly => true,
Expand Down
2 changes: 1 addition & 1 deletion manifests/reload/complete.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

include firewalld::reload

exec{ 'firewalld::complete-reload':
exec { 'firewalld::complete-reload':
path => '/usr/bin:/bin',
command => 'firewall-cmd --complete-reload',
refreshonly => true,
Expand Down

0 comments on commit 739727e

Please sign in to comment.