Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

puppet-lint: fix current violations #138

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions manifests/certificate/x509.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#
# - `puppetlabs/stdlib`
#
define openssl::certificate::x509(
define openssl::certificate::x509 (
String $country,
String $organization,
String $commonname,
Expand Down Expand Up @@ -118,8 +118,7 @@
Boolean $force = true,
String $cnf_tpl = 'openssl/cert.cnf.erb',
Boolean $encrypted = true,
) {

) {
$_key_owner = pick($key_owner, $owner)
$_key_group = pick($key_group, $group)
$_cnf_dir = pick($cnf_dir, $base_dir)
Expand Down
3 changes: 1 addition & 2 deletions manifests/certificates.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#
class openssl::certificates (
Hash $x509_certs = {},
){

) {
if $x509_certs {
ensure_resources('openssl::certificate::x509', $x509_certs)
}
Expand Down
36 changes: 18 additions & 18 deletions manifests/configs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
Optional[Array] $keyusages = undef,
Optional[Array] $subjectaltnames = undef,
Hash $conffiles = {},
){

) {
# dpendencies: ensure config file is generated before potential usage
File<| tag=='openssl-configs' |> -> Ssl_pkey<| |>
File<| tag=='openssl-configs' |> -> X509_cert<| |>
Expand All @@ -80,22 +79,23 @@
owner => pick($vals['owner'], $owner),
group => pick($vals['group'], $group),
mode => pick($vals['mode'], $mode),
content => epp('openssl/cert.cnf.epp', {
country => $country,
state => $state,
locality => $locality,
organization => $organization,
unit => $unit,
email => $email,
default_bits => $default_bits,
default_md => $default_md,
default_keyfile => $default_keyfile,
basicconstraints => $basicconstraints,
extendedkeyusages => $extendedkeyusages,
keyusages => $keyusages,
subjectaltnames => $subjectaltnames,
} + delete($vals,['ensure', 'owner', 'group', 'mode']),
),
content => epp('openssl/cert.cnf.epp',
{
country => $country,
state => $state,
locality => $locality,
organization => $organization,
unit => $unit,
email => $email,
default_bits => $default_bits,
default_md => $default_md,
default_keyfile => $default_keyfile,
basicconstraints => $basicconstraints,
extendedkeyusages => $extendedkeyusages,
keyusages => $keyusages,
subjectaltnames => $subjectaltnames,
} + delete($vals,['ensure', 'owner', 'group', 'mode']),
),
tag => 'openssl-configs',
}
}
Expand Down
13 changes: 6 additions & 7 deletions manifests/dhparam.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# - `puppetlabs/stdlib`
#
define openssl::dhparam(
define openssl::dhparam (
Stdlib::Absolutepath $path = $name,
Enum['present', 'absent'] $ensure = present,
Integer[1] $size = 2048,
Expand All @@ -23,7 +23,6 @@
String $mode = '0644',
Boolean $fastmode = false,
) {

dhparam { $path:
ensure => $ensure,
size => $size,
Expand All @@ -32,10 +31,10 @@

# Set file access
file { $path:
ensure => $ensure,
owner => $owner,
group => $group,
mode => $mode,
require => Dhparam[$path];
ensure => $ensure,
owner => $owner,
group => $group,
mode => $mode,
require => Dhparam[$path];
}
}
4 changes: 2 additions & 2 deletions manifests/export/pem_cert.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#local variables

# If ensure = present and der_cert and $pfx_cert as being specified, then throw error
if $ensure == present and !$der_cert and !$pfx_cert {
if $ensure == present and !$der_cert and !$pfx_cert {
fail('Parameter Error: either pfx_cert or der_cert must be specified')
}

Expand Down Expand Up @@ -53,7 +53,7 @@

exec { "Export ${in_cert} to ${pem_cert}":
command => inline_template('<%= @cmd.join(" ") %>'),
path => $::path,
path => $facts['path'],
creates => $pem_cert,
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion manifests/export/pem_key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

exec { "Export ${pfx_cert} to ${pem_key}":
command => inline_template('<%= @cmd.join(" ") %>'),
path => $::path,
path => $facts['path'],
creates => $pem_key,
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions manifests/export/pkcs12.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# [*out_pass*] - PKCS12 password
# [*chaincert*] - chain certificate to include in pkcs12
#
define openssl::export::pkcs12(
define openssl::export::pkcs12 (
Stdlib::Absolutepath $basedir,
Stdlib::Absolutepath $pkey,
Stdlib::Absolutepath $cert,
Expand Down Expand Up @@ -47,9 +47,9 @@
$passout_opt,
]

exec {"Export ${name} to ${basedir}/${name}.p12":
exec { "Export ${name} to ${basedir}/${name}.p12":
command => inline_template('<%= @cmd.join(" ") %>'),
path => $::path,
path => $facts['path'],
creates => "${basedir}/${name}.p12",
}
} else {
Expand Down
4 changes: 1 addition & 3 deletions manifests/packages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
}

if $facts['os']['family'] in ['Debian', 'RedHat'] {
ensure_packages(['ca-certificates'], {
ensure => $openssl::ca_certificates_ensure,
})
ensure_packages(['ca-certificates'], { ensure => $openssl::ca_certificates_ensure, })

if $facts['os']['family'] == 'Debian' {
exec { 'update-ca-certificates':
Expand Down