Skip to content

Commit

Permalink
rubocop: autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Feb 24, 2024
1 parent 57d3c39 commit cb8d9bc
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 74 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
inherit_from: .rubocop_todo.yml

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

Expand Down
80 changes: 80 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-02-24 22:47:48 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 9
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/defines/ca_spec.rb'

# Offense count: 10
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/classes/ca_cert_spec.rb'
- 'spec/classes/params_spec.rb'
- 'spec/defines/ca_spec.rb'

# Offense count: 1
# Configuration parameters: MaximumRangeSize.
Lint/MissingCopEnableDirective:
Exclude:
- 'spec/classes/update_spec.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/spec_helper_acceptance.rb'

# Offense count: 2
# Configuration parameters: Max.
RSpec/IndexedLet:
Exclude:
- 'spec/defines/ca_spec.rb'

# Offense count: 9
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/defines/ca_spec.rb'

# Offense count: 28
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 8

# Offense count: 2
RSpec/RepeatedExampleGroupBody:
Exclude:
- 'spec/acceptance/ca_cert_ca_spec.rb'

# Offense count: 2
RSpec/RepeatedExampleGroupDescription:
Exclude:
- 'spec/defines/ca_spec.rb'

# Offense count: 2
RSpec/VoidExpect:
Exclude:
- 'spec/defines/ca_spec.rb'

# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'spec/acceptance/ca_cert_ca_spec.rb'
- 'spec/acceptance/class_spec.rb'
- 'spec/classes/ca_cert_spec.rb'
- 'spec/classes/params_spec.rb'
- 'spec/classes/update_spec.rb'
- 'spec/defines/ca_spec.rb'
78 changes: 39 additions & 39 deletions spec/acceptance/ca_cert_ca_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,48 @@
describe 'ca_cert::ca' do
context 'with some normal usage' do
let(:pp) do
<<-EOS
include ::ca_cert
<<~EOS
include ::ca_cert
ca_cert::ca { 'Globalsign_Org_Intermediate':
source => 'http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt',
}
ca_cert::ca { 'Globalsign_Org_Intermediate':
source => 'http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt',
}
ca_cert::ca { 'InCommon':
ca_text => '-----BEGIN CERTIFICATE-----
MIIEwzCCA6ugAwIBAgIQf3HB06ImsNKxE/PmgWdkPjANBgkqhkiG9w0BAQUFADBv
MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
eHRlcm5hbCBDQSBSb290MB4XDTEwMTIwNzAwMDAwMFoXDTIwMDUzMDEwNDgzOFow
UTELMAkGA1UEBhMCVVMxEjA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WJ7cwFif2Ns2Gig7mqojR8p89AYrK0CAwEAAaOCAXcwggFz
MB8GA1UdIwQYMBaAFK29mHo0tCb3+sQmVO8DveAky1QaMB0GA1UdDgQWBBRIT1r6
L0qaXuBQ82t7VaXe9b40XTAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB
/wIBADARBgNVHSAECjAIMAYGBFUdIAAwRAYDVR0fBD0wOzA5oDegNYYzaHR0cDov
L2NybC51c2VydHJ1c3QuY29tL0FkZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMIGz
BggrBgEFBQcBAQSBpjCBozA/BggrBgEFBQcwAoYzaHR0cDovL2NydC51c2VydHJ1
c3QuY29tL0FkZFRydXN0RXh0ZXJuYWxDQVJvb3QucDdjMDkGCCsGAQUFBzAChi1o
dHRwOi8vY3J0LnVzZXJ0cnVzdC5jb20vQWRkVHJ1c3RVVE5TR0NDQS5jcnQwJQYI
KwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEF
BQADggEBAJNmIYB0RYVLwqvOMrAp/t3f1iRbvwNqb1A+DhuzDYijW+7EpBI7Vu8G
f89/IZVWO0Ex/uGqk9KV85UNPEerylwmrT7x+Yw0bhG+9GfjAkn5pnx7ZCXdF0by
UOPjCiE6SSTNxoRlaGdosEUtR5nNnKuGKRFy3NacNkN089SXnlag/l9AWNLV1358
xY4asgRckmYOha0uBs7Io9jrFCeR3s8XMIFTtmYSrTfk9e+WXCAONumsYn0ZgYr1
kGGmSavOPN/mymTugmU5RZUWukEGAJi6DFZh5MbGhgHPZqkiKQLWPc/EKo2Z3vsJ
FJ4O0dXG14HdrSSrrAcF4h1ow3BmX9M=
-----END CERTIFICATE-----',
}
ca_cert::ca { 'CACert':
source => 'http://www.cacert.org/certs/root.crt',
ensure => 'distrusted',
}
ca_cert::ca { 'CACert':
source => 'http://www.cacert.org/certs/root.crt',
ensure => 'distrusted',
}
EOS
end

Expand Down
20 changes: 11 additions & 9 deletions spec/classes/ca_cert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'ensure' => 'directory',
'path' => '/usr/local/share/ca-certificates',
'group' => 'staff',
'purge' => 'false',
'purge' => 'false'
)
}

Expand All @@ -43,11 +43,12 @@
'ensure' => 'directory',
'path' => '/usr/local/share/ca-certificates',
'group' => 'staff',
'purge' => 'true',
'purge' => 'true'
)
}
end
end

context 'on a RedHat based OS' do
let :facts do
{
Expand All @@ -71,7 +72,7 @@
'ensure' => 'directory',
'path' => '/etc/pki/ca-trust/source/anchors',
'group' => 'root',
'purge' => 'false',
'purge' => 'false'
)
}

Expand All @@ -87,13 +88,13 @@
'ensure' => 'directory',
'path' => '/etc/pki/ca-trust/source/anchors',
'group' => 'root',
'purge' => 'true',
'purge' => 'true'
)
}
end
end

['10', '11'].each do |osmajrel|
%w[10 11].each do |osmajrel|
context "on a Suse #{osmajrel} based OS" do
let :facts do
{
Expand All @@ -115,7 +116,7 @@
'ensure' => 'directory',
'path' => '/etc/ssl/certs',
'group' => 'root',
'purge' => 'false',
'purge' => 'false'
)
}

Expand All @@ -131,7 +132,7 @@
'ensure' => 'directory',
'path' => '/etc/ssl/certs',
'group' => 'root',
'purge' => 'true',
'purge' => 'true'
)
}
end
Expand Down Expand Up @@ -159,7 +160,7 @@
'ensure' => 'directory',
'path' => '/etc/pki/trust/anchors',
'group' => 'root',
'purge' => 'false',
'purge' => 'false'
)
}

Expand All @@ -175,11 +176,12 @@
'ensure' => 'directory',
'path' => '/etc/pki/trust/anchors',
'group' => 'root',
'purge' => 'true',
'purge' => 'true'
)
}
end
end

context 'on an unsupported operating system' do
let :facts do
{
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
it { is_expected.to contain_class('ca_cert::params') }
end

[
'Debian',
'RedHat',
%w[
Debian
RedHat
].each do |osfamily|
let :facts do
{
Expand All @@ -27,7 +27,7 @@
end
end

['10', '11', '12'].each do |osmajrel|
%w[10 11 12].each do |osmajrel|
context "On a Suse #{osmajrel} Operating System" do
let :facts do
{
Expand Down
10 changes: 6 additions & 4 deletions spec/classes/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
case facts[:os]['family']
when 'Debian'
it { is_expected.not_to contain_exec('enable_ca_trust') }

it {
is_expected.to contain_exec('ca_cert_update').with(
command: 'update-ca-certificates',
refreshonly: true,
refreshonly: true
)
}
when 'RedHat'
Expand All @@ -39,24 +40,25 @@
it {
is_expected.to contain_exec('ca_cert_update').with(
command: 'update-ca-trust extract',
refreshonly: true,
refreshonly: true
)
}
when 'Suse'
it { is_expected.not_to contain_exec('enable_ca_trust') }

case facts[:os]['release']['major']
when '10', '11'
it {
is_expected.to contain_exec('ca_cert_update').with(
command: 'c_rehash',
refreshonly: true,
refreshonly: true
)
}
when '12', '13', '42'
it {
is_expected.to contain_exec('ca_cert_update').with(
command: 'update-ca-certificates',
refreshonly: true,
refreshonly: true
)
}
end
Expand Down
Loading

0 comments on commit cb8d9bc

Please sign in to comment.