Skip to content

Commit

Permalink
Merge pull request #332 from voxpupuli/simplify-iterate_access
Browse files Browse the repository at this point in the history
Simplify some code duplication
  • Loading branch information
smortex authored Oct 7, 2021
2 parents e3de7ff + 995aea4 commit 74e6602
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions manifests/server/iterate_access.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,17 @@
fail('$access variable must be an array')
}

if $position == 0 { # the first entry
$previous_position = $position - 1

openldap::server::access { "${position} on ${suffix}" :
what => $what,
access => $access,
}
} elsif $position == $count { #the last entry

$previous_position = $position - 1
openldap::server::access { "${position} on ${suffix}" :
what => $what,
access => $access,
require => Openldap::Server::Access["${previous_position} on ${suffix}"],
}
if $previous_position < 0 {
$require = []
} else {
$previous_position = $position - 1
openldap::server::access { "${position} on ${suffix}" :
what => $what,
access => $access,
require => Openldap::Server::Access["${previous_position} on ${suffix}"],
}
$require = Openldap::Server::Access["${previous_position} on ${suffix}"]
}

openldap::server::access { "${position} on ${suffix}" :
what => $what,
access => $access,
require => $require,
}
}

0 comments on commit 74e6602

Please sign in to comment.