Skip to content

Commit 33a3634

Browse files
author
jordanbreen28
committed
(CONT-792) - Correct Layout/HashAlignment
1 parent 4d95ef7 commit 33a3634

File tree

10 files changed

+80
-97
lines changed

10 files changed

+80
-97
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# This cop supports safe autocorrection (--autocorrect).
2-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
3-
# SupportedHashRocketStyles: key, separator, table
4-
# SupportedColonStyles: key, separator, table
5-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
6-
Layout/HashAlignment:
7-
Exclude:
8-
- 'lib/puppet/functions/postgresql/postgresql_acls_to_resources_hash.rb'
9-
- 'spec/classes/globals_spec.rb'
10-
- 'spec/classes/server_spec.rb'
11-
- 'spec/defines/server/database_spec.rb'
12-
- 'spec/defines/server/default_privileges_spec.rb'
13-
- 'spec/defines/server/grant_spec.rb'
14-
- 'spec/defines/server/role_spec.rb'
15-
- 'spec/functions/postgresql_postgresql_acls_to_resources_hash_spec.rb'
16-
- 'spec/spec_helper_local.rb'
17-
181
# Offense count: 1
192
# This cop supports safe autocorrection (--autocorrect).
203
Layout/HeredocIndentation:

lib/puppet/functions/postgresql/postgresql_acls_to_resources_hash.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def default_impl(acls, id, offset)
3131
end
3232

3333
resource = {
34-
'type' => parts[0],
34+
'type' => parts[0],
3535
'database' => parts[1],
36-
'user' => parts[2],
37-
'order' => '%03d' % (offset + index),
36+
'user' => parts[2],
37+
'order' => '%03d' % (offset + index),
3838
}
3939
if parts[0] == 'local'
4040
resource['auth_method'] = parts[3]

spec/classes/globals_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
it do
5050
is_expected.to contain_yumrepo('yum.postgresql.org').with(
5151
'enabled' => '1',
52-
'proxy' => 'http://proxy-server:8080',
52+
'proxy' => 'http://proxy-server:8080',
5353
)
5454
is_expected.to contain_yumrepo('pgdg-common').with(
5555
'enabled' => '1',
56-
'proxy' => 'http://proxy-server:8080',
56+
'proxy' => 'http://proxy-server:8080',
5757
)
5858
end
5959
end

spec/classes/server_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class { 'postgresql::globals':
6262
end
6363
it 'sets postgres password' do
6464
is_expected.to contain_exec('set_postgres_postgrespw').with('command' => '/usr/bin/psql -c "ALTER ROLE \"postgres\" PASSWORD ${NEWPASSWD_ESCAPED}"',
65-
'user' => 'postgres',
65+
'user' => 'postgres',
6666
'environment' => ['PGPASSWORD=new-p@s$word-to-set', 'PGPORT=5432', 'NEWPASSWD_ESCAPED=$$new-p@s$word-to-set$$'],
6767
'unless' => "/usr/bin/psql -h localhost -p 5432 -c 'select 1' > /dev/null")
6868
end
@@ -84,7 +84,7 @@ class { 'postgresql::globals':
8484
end
8585
it 'sets postgres password' do
8686
is_expected.to contain_exec('set_postgres_postgrespw').with('command' => ['/usr/bin/psql -c "ALTER ROLE \"postgres\" PASSWORD ${NEWPASSWD_ESCAPED}"'],
87-
'user' => 'postgres',
87+
'user' => 'postgres',
8888
'environment' => ['PGPASSWORD=new-p@s$word-to-set', 'PGPORT=5432', 'NEWPASSWD_ESCAPED=$$new-p@s$word-to-set$$'],
8989
'unless' => "/usr/bin/psql -h localhost -p 5432 -c 'select 1' > /dev/null")
9090
end

spec/defines/server/database_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class {'postgresql::server':}"
4444
let(:params) do
4545
{ connect_settings: { 'PGHOST' => 'postgres-db-server',
4646
'DBVERSION' => '9.1',
47-
'PGPORT' => '1234' } }
47+
'PGPORT' => '1234' } }
4848
end
4949

5050
it { is_expected.to contain_postgresql_psql('CREATE DATABASE "test"').with_connect_settings('PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', 'PGPORT' => '1234').with_port(nil) }

spec/defines/server/default_privileges_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class { 'postgresql::server': }
221221
object_type: 'tables',
222222
connect_settings: { 'PGHOST' => 'postgres-db-server',
223223
'DBVERSION' => '9.6',
224-
'PGPORT' => '1234' },
224+
'PGPORT' => '1234' },
225225
}
226226
end
227227

spec/defines/server/grant_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
role: 'test',
122122
connect_settings: { 'PGHOST' => 'postgres-db-server',
123123
'DBVERSION' => '9.1',
124-
'PGPORT' => '1234' },
124+
'PGPORT' => '1234' },
125125
}
126126
end
127127

spec/defines/server/role_spec.rb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
it { is_expected.to contain_postgresql__server__role('test') }
2424
it 'has create role for "test" user with password as ****' do
2525
is_expected.to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****')
26-
.with('command' => 'Sensitive [value redacted]',
27-
'sensitive' => 'true',
28-
'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'",
29-
'port' => '5432')
26+
.with('command' => 'Sensitive [value redacted]',
27+
'sensitive' => 'true',
28+
'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'",
29+
'port' => '5432')
3030
end
3131
it 'has alter role for "test" user with password as ****' do
3232
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
33-
.with('command' => 'Sensitive [value redacted]',
34-
'sensitive' => 'true',
35-
'unless' => 'Sensitive [value redacted]',
36-
'port' => '5432')
33+
.with('command' => 'Sensitive [value redacted]',
34+
'sensitive' => 'true',
35+
'unless' => 'Sensitive [value redacted]',
36+
'port' => '5432')
3737
end
3838
end
3939

@@ -47,27 +47,27 @@
4747
it { is_expected.to contain_postgresql__server__role('test') }
4848
it 'has create role for "test" user with password as ****' do
4949
is_expected.to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****')
50-
.with('command' => 'Sensitive [value redacted]',
51-
'sensitive' => 'true',
52-
'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'",
53-
'port' => '5432')
50+
.with('command' => 'Sensitive [value redacted]',
51+
'sensitive' => 'true',
52+
'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'",
53+
'port' => '5432')
5454
end
5555
it 'has alter role for "test" user with password as ****' do
5656
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
57-
.with('command' => 'Sensitive [value redacted]',
58-
'sensitive' => 'true',
59-
'unless' => 'Sensitive [value redacted]',
60-
'port' => '5432')
57+
.with('command' => 'Sensitive [value redacted]',
58+
'sensitive' => 'true',
59+
'unless' => 'Sensitive [value redacted]',
60+
'port' => '5432')
6161
end
6262
end
6363

6464
context 'with specific db connection settings - default port' do
6565
let :params do
6666
{
6767
password_hash: 'new-pa$s',
68-
connect_settings: { 'PGHOST' => 'postgres-db-server',
69-
'DBVERSION' => '9.1',
70-
'PGUSER' => 'login-user',
68+
connect_settings: { 'PGHOST' => 'postgres-db-server',
69+
'DBVERSION' => '9.1',
70+
'PGUSER' => 'login-user',
7171
'PGPASSWORD' => 'login-pass' },
7272
}
7373
end
@@ -89,7 +89,7 @@
8989
it 'has alter role for "test" user with password as ****' do
9090
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
9191
.with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true',
92-
'unless' => 'Sensitive [value redacted]', 'port' => '5432',
92+
'unless' => 'Sensitive [value redacted]', 'port' => '5432',
9393
'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1',
9494
'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' })
9595
end
@@ -100,9 +100,9 @@
100100
{
101101
password_hash: 'new-pa$s',
102102
connect_settings: { 'PGHOST' => 'postgres-db-server',
103-
'DBVERSION' => '9.1',
104-
'PGPORT' => '1234',
105-
'PGUSER' => 'login-user',
103+
'DBVERSION' => '9.1',
104+
'PGPORT' => '1234',
105+
'PGUSER' => 'login-user',
106106
'PGPASSWORD' => 'login-pass' },
107107
}
108108
end
@@ -114,15 +114,15 @@
114114
it { is_expected.to contain_postgresql__server__role('test') }
115115
it 'has create role for "test" user with password as ****' do
116116
is_expected.to contain_postgresql_psql('CREATE ROLE test ENCRYPTED PASSWORD ****')
117-
.with('command' => 'Sensitive [value redacted]',
117+
.with('command' => 'Sensitive [value redacted]',
118118
'sensitive' => 'true', 'unless' => "SELECT 1 FROM pg_roles WHERE rolname = 'test'",
119119
'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1',
120120
'PGPORT' => '1234', 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' })
121121
end
122122
it 'has alter role for "test" user with password as ****' do
123123
is_expected.to contain_postgresql_psql('ALTER ROLE test ENCRYPTED PASSWORD ****')
124124
.with('command' => 'Sensitive [value redacted]', 'sensitive' => 'true',
125-
'unless' => 'Sensitive [value redacted]',
125+
'unless' => 'Sensitive [value redacted]',
126126
'connect_settings' => { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1',
127127
'PGPORT' => '1234', 'PGUSER' => 'login-user', 'PGPASSWORD' => 'login-pass' })
128128
end
@@ -171,9 +171,9 @@
171171
{
172172
password_hash: 'new-pa$s',
173173
connect_settings: { 'PGHOST' => 'postgres-db-server',
174-
'DBVERSION' => '9.1',
175-
'PGPORT' => '1234',
176-
'PGUSER' => 'login-user',
174+
'DBVERSION' => '9.1',
175+
'PGPORT' => '1234',
176+
'PGUSER' => 'login-user',
177177
'PGPASSWORD' => 'login-pass' },
178178
psql_user: 'postgresql',
179179
psql_group: 'postgresql',

spec/functions/postgresql_postgresql_acls_to_resources_hash_spec.rb

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
input = 'local all postgres ident'
1010
result = {
1111
'postgresql class generated rule test 0' => {
12-
'type' => 'local',
13-
'database' => 'all',
14-
'user' => 'postgres',
12+
'type' => 'local',
13+
'database' => 'all',
14+
'user' => 'postgres',
1515
'auth_method' => 'ident',
16-
'order' => '100',
16+
'order' => '100',
1717
},
1818
}
1919
is_expected.to run.with_params([input], 'test', 100).and_return(result)
@@ -23,11 +23,11 @@
2323
input = 'local all root ident'
2424
result = {
2525
'postgresql class generated rule test 0' => {
26-
'type' => 'local',
27-
'database' => 'all',
28-
'user' => 'root',
26+
'type' => 'local',
27+
'database' => 'all',
28+
'user' => 'root',
2929
'auth_method' => 'ident',
30-
'order' => '100',
30+
'order' => '100',
3131
},
3232
}
3333
is_expected.to run.with_params([input], 'test', 100).and_return(result)
@@ -37,11 +37,11 @@
3737
input_array = ['local all all ident']
3838
result = {
3939
'postgresql class generated rule test 0' => {
40-
'type' => 'local',
41-
'database' => 'all',
42-
'user' => 'all',
40+
'type' => 'local',
41+
'database' => 'all',
42+
'user' => 'all',
4343
'auth_method' => 'ident',
44-
'order' => '100',
44+
'order' => '100',
4545
},
4646
}
4747
is_expected.to run.with_params(input_array, 'test', 100).and_return(result)
@@ -51,12 +51,12 @@
5151
input = 'host all all 127.0.0.1/32 md5'
5252
result = {
5353
'postgresql class generated rule test 0' => {
54-
'type' => 'host',
55-
'database' => 'all',
56-
'user' => 'all',
57-
'address' => '127.0.0.1/32',
54+
'type' => 'host',
55+
'database' => 'all',
56+
'user' => 'all',
57+
'address' => '127.0.0.1/32',
5858
'auth_method' => 'md5',
59-
'order' => '100',
59+
'order' => '100',
6060
},
6161
}
6262
is_expected.to run.with_params([input], 'test', 100).and_return(result)
@@ -66,12 +66,12 @@
6666
input = 'host all all 0.0.0.0/0 md5'
6767
result = {
6868
'postgresql class generated rule test 0' => {
69-
'type' => 'host',
70-
'database' => 'all',
71-
'user' => 'all',
72-
'address' => '0.0.0.0/0',
69+
'type' => 'host',
70+
'database' => 'all',
71+
'user' => 'all',
72+
'address' => '0.0.0.0/0',
7373
'auth_method' => 'md5',
74-
'order' => '100',
74+
'order' => '100',
7575
},
7676
}
7777
is_expected.to run.with_params([input], 'test', 100).and_return(result)
@@ -81,12 +81,12 @@
8181
input = 'host all all ::1/128 md5'
8282
result = {
8383
'postgresql class generated rule test 0' => {
84-
'type' => 'host',
85-
'database' => 'all',
86-
'user' => 'all',
87-
'address' => '::1/128',
84+
'type' => 'host',
85+
'database' => 'all',
86+
'user' => 'all',
87+
'address' => '::1/128',
8888
'auth_method' => 'md5',
89-
'order' => '100',
89+
'order' => '100',
9090
},
9191
}
9292
is_expected.to run.with_params([input], 'test', 100).and_return(result)
@@ -96,12 +96,12 @@
9696
input = 'host all all 1.1.1.1 255.255.255.0 md5'
9797
result = {
9898
'postgresql class generated rule test 0' => {
99-
'type' => 'host',
100-
'database' => 'all',
101-
'user' => 'all',
102-
'address' => '1.1.1.1 255.255.255.0',
99+
'type' => 'host',
100+
'database' => 'all',
101+
'user' => 'all',
102+
'address' => '1.1.1.1 255.255.255.0',
103103
'auth_method' => 'md5',
104-
'order' => '100',
104+
'order' => '100',
105105
},
106106
}
107107

@@ -114,11 +114,11 @@
114114
'postgresql class generated rule test 0' => {
115115
'type' => 'host',
116116
'database' => 'all',
117-
'user' => 'all',
118-
'address' => '1.1.1.1 255.255.255.0',
117+
'user' => 'all',
118+
'address' => '1.1.1.1 255.255.255.0',
119119
'auth_method' => 'ldap',
120120
'auth_option' => 'ldapserver=ldap.example.net ldapprefix="cn=" ldapsuffix=", dc=example, dc=net"',
121-
'order' => '100',
121+
'order' => '100',
122122
},
123123
}
124124

spec/spec_helper_local.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ def param(type, title, param)
151151
selinux: true,
152152
os: {
153153
'architecture' => 'x86_64',
154-
'family' => 'RedHat',
155-
'hardware' => 'x86_64',
156-
'name' => 'Fedora',
157-
'release' => {
158-
'full' => '33',
154+
'family' => 'RedHat',
155+
'hardware' => 'x86_64',
156+
'name' => 'Fedora',
157+
'release' => {
158+
'full' => '33',
159159
'major' => '33',
160160
'minor' => '33',
161161
},
@@ -175,7 +175,7 @@ def param(type, title, param)
175175
family: 'RedHat',
176176
name: 'Amazon',
177177
release: {
178-
'full' => '1.0',
178+
'full' => '1.0',
179179
'major' => '1',
180180
},
181181
selinux: { 'enabled' => true },
@@ -196,7 +196,7 @@ def param(type, title, param)
196196
family: 'Gentoo',
197197
name: 'Gentoo',
198198
release: {
199-
'full' => 'unused',
199+
'full' => 'unused',
200200
'major' => 'unused',
201201
},
202202
selinux: { 'enabled' => false },

0 commit comments

Comments
 (0)