Skip to content

Commit 9d2966f

Browse files
committed
fix(rubocop): add fixes using rubocop -a --safe [skip ci]
1 parent 0dd9bd3 commit 9d2966f

File tree

4 files changed

+149
-146
lines changed

4 files changed

+149
-146
lines changed

test/integration/default/controls/config_spec.rb

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# Set defaults, use debian as base
23

34
conf_user = 'bind'
@@ -17,7 +18,7 @@
1718

1819
# Override by OS
1920
case os[:name]
20-
when 'arch','redhat', 'centos', 'fedora', 'amazon'
21+
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
2122
conf_user = 'named'
2223
conf_group = 'named'
2324
keys_group = 'root'
@@ -28,8 +29,8 @@
2829
keys_mode = '0755'
2930
conf_mode = '0640'
3031
config = '/etc/named.conf'
31-
when 'suse', 'opensuse'
32-
conf_user = 'root'
32+
when 'suse', 'opensuse'
33+
conf_user = 'root'
3334
conf_group = 'named'
3435
logs_user = 'root'
3536
logs_group = 'root'
@@ -47,11 +48,11 @@
4748
# Override log directory by OS
4849
case os[:name]
4950
when 'arch', 'ubuntu'
50-
log_directory = '/var/log/named'
51+
log_directory = '/var/log/named'
5152
when 'redhat', 'centos', 'fedora', 'amazon'
52-
log_directory = '/var/named/data'
53+
log_directory = '/var/named/data'
5354
when 'suse', 'opensuse'
54-
log_directory = '/var/log'
55+
log_directory = '/var/log'
5556
end
5657

5758
# Check main config dir
@@ -101,28 +102,28 @@
101102
# RHEL: Doesn't use .options and has rfc1912.zones
102103
# Debian: Uses .options
103104
case os[:name]
104-
when 'arch','redhat', 'centos', 'fedora', 'amazon'
105+
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
105106
control 'File ' + config do
106-
title 'should exist'
107+
title 'should exist'
107108
describe file(config) do
108-
its('owner') { should eq conf_user }
109+
its('owner') { should eq conf_user }
109110
its('group') { should eq conf_group }
110111
its('mode') { should cmp conf_mode }
111-
its('content') { should match /^include\ "\/etc\/named\.rfc1912\.zones";/ }
112-
its('content') { should match /^include\ "\/etc\/named\.conf\.local";/ }
113-
end
112+
its('content') { should match %r{^include\ "/etc/named\.rfc1912\.zones";} }
113+
its('content') { should match %r{^include\ "/etc/named\.conf\.local";} }
114114
end
115+
end
115116
when 'ubuntu', 'debian'
116117
control 'File ' + config do
117-
title 'should exist'
118+
title 'should exist'
118119
describe file(config) do
119-
its('owner') { should eq conf_user }
120+
its('owner') { should eq conf_user }
120121
its('group') { should eq conf_group }
121122
its('mode') { should cmp conf_mode }
122-
its('content') { should match /^include\ "\/etc\/bind\/named\.conf\.local";/ }
123-
its('content') { should match /^include\ "\/etc\/bind\/named\.conf\.options";/ }
124-
end
123+
its('content') { should match %r{^include\ "/etc/bind/named\.conf\.local";} }
124+
its('content') { should match %r{^include\ "/etc/bind/named\.conf\.options";} }
125125
end
126+
end
126127
end
127128

128129
# If debian check the .options file
@@ -154,20 +155,20 @@
154155
# the #{foo} is a ruby string expansion so we can use the variables
155156
# defined above
156157
# Match example.com zone from the pillar
157-
its('content') { should match /^zone\ "example\.com"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/example\.com";\n\ \ \n\ \ update-policy\ {\n\ \ \ \ grant\ core_dhcp\ name\ dns_entry_allowed_to_update\.\ ANY;\n\ \ \};\n\ \ notify\ no;\n\};/ }
158+
its('content') { should match %r{^zone\ "example\.com"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/example\.com";\n\ \ \n\ \ update-policy\ {\n\ \ \ \ grant\ core_dhcp\ name\ dns_entry_allowed_to_update\.\ ANY;\n\ \ \};\n\ \ notify\ no;\n\};} }
158159
# Match example.net from pillar
159-
its('content') { should match /^zone\ "example\.net"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/example\.net";\n\ \ \n\ \ notify\ no;\n\};/ }
160+
its('content') { should match %r{^zone\ "example\.net"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/example\.net";\n\ \ \n\ \ notify\ no;\n\};} }
160161
# Match example.org from pillar
161-
its('content') { should match /^zone\ "example\.org"\ {\n\ \ type\ slave;\n\ \ file\ "#{zones_directory}\/";\n\ \ \n\ \ notify\ no;\n\ \ masters\ \{\n\ \ \ \ 192\.0\.2\.1;\n\ \ \ \ 192\.0\.2\.2;\n\ \ \};\n\};/ }
162+
its('content') { should match %r{^zone\ "example\.org"\ {\n\ \ type\ slave;\n\ \ file\ "#{zones_directory}/";\n\ \ \n\ \ notify\ no;\n\ \ masters\ \{\n\ \ \ \ 192\.0\.2\.1;\n\ \ \ \ 192\.0\.2\.2;\n\ \ \};\n\};} }
162163
# Match 113.0.203 reverse zone from pillar
163-
its('content') { should match /^zone\ "113\.0\.203\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/113\.0\.203\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
164+
its('content') { should match %r{^zone\ "113\.0\.203\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/113\.0\.203\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};} }
164165
# Match 100.51.198 reverse zone from pillar
165-
its('content') { should match /^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
166+
its('content') { should match %r{^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};} }
166167
# Match logging
167-
its('content') { should match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
168+
its('content') { should match %r{^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};} }
168169
# Match acl1
169-
its('content') { should match /acl\ client1\ \{\n\ \ 127\.0\.0\.0\/8;\n\ \ 10\.20\.0\.0\/16;\n\};/ }
170+
its('content') { should match %r{acl\ client1\ \{\n\ \ 127\.0\.0\.0/8;\n\ \ 10\.20\.0\.0/16;\n\};} }
170171
# Match acl2
171-
its('content') { should match /^acl\ client2\ \{\n\ \ 10\.30\.0\.0\/8;\n\};/ }
172+
its('content') { should match %r{^acl\ client2\ \{\n\ \ 10\.30\.0\.0/8;\n\};} }
172173
end
173174
end
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1+
# frozen_string_literal: true
12

23
case os[:name]
34
when 'arch'
4-
os_packages = %w(
5+
os_packages = %w[
56
bind
67
bind-tools
78
dnssec-tools
8-
)
9+
]
910
when 'redhat', 'centos', 'fedora', 'amazon'
10-
os_packages = %w(bind)
11+
os_packages = %w[bind]
1112
when 'suse', 'opensuse'
12-
os_packages = %w(bind)
13+
os_packages = %w[bind]
1314
when 'debian', 'ubuntu'
14-
os_packages = %w(
15+
os_packages = %w[
1516
bind9
1617
bind9utils
17-
)
18+
]
1819
end
1920

2021
control 'Bind9 packages' do
@@ -26,4 +27,3 @@
2627
end
2728
end
2829
end
29-

test/integration/default/controls/service_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# frozen_string_literal: true
12

23
case os[:name]
3-
when 'arch','redhat', 'centos', 'fedora', 'amazon'
4+
when 'arch', 'redhat', 'centos', 'fedora', 'amazon'
45
service = 'named'
56
when 'suse', 'opensuse'
67
service = 'named'
@@ -12,7 +13,7 @@
1213
title 'should be running'
1314

1415
describe service(service) do
15-
# it { should be_enabled }
16+
# it { should be_enabled }
1617
it { should be_running }
1718
end
1819
end

0 commit comments

Comments
 (0)