diff --git a/.rubocop.yml b/.rubocop.yml index 47b1aadbe6..439ea84ee8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,7 @@ require: AllCops: NewCops: enable DisplayCopNames: true - TargetRubyVersion: 3.1 + TargetRubyVersion: '2.6' Include: - "**/*.rb" Exclude: diff --git a/lib/puppet/functions/postgresql/postgresql_password.rb b/lib/puppet/functions/postgresql/postgresql_password.rb index f34d412779..9ca4d81dbb 100644 --- a/lib/puppet/functions/postgresql/postgresql_password.rb +++ b/lib/puppet/functions/postgresql/postgresql_password.rb @@ -66,7 +66,7 @@ def pg_sha256(password, salt) def digest_key(password, salt) OpenSSL::KDF.pbkdf2_hmac( password, - salt:, + salt: salt, iterations: 4096, length: 32, hash: OpenSSL::Digest.new('SHA256'), diff --git a/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index 59ba15d2a5..a5430e821a 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -29,7 +29,7 @@ def parse_config else matches[:value].delete("'") end - attributes_hash = { line_number:, key: matches[:key], ensure: 'present', value:, comment: matches[:comment] } + attributes_hash = { line_number: line_number, key: matches[:key], ensure: 'present', value: value, comment: matches[:comment] } active_settings.push(attributes_hash) end end diff --git a/lib/puppet/provider/postgresql_replication_slot/ruby.rb b/lib/puppet/provider/postgresql_replication_slot/ruby.rb index 257de341a3..31271cc51b 100644 --- a/lib/puppet/provider/postgresql_replication_slot/ruby.rb +++ b/lib/puppet/provider/postgresql_replication_slot/ruby.rb @@ -7,7 +7,7 @@ def self.instances run_sql_command('SELECT * FROM pg_replication_slots;')[0].split("\n").select { |l| l.include?('|') }.map do |l| name, *_others = l.strip.split(%r{\s+\|\s+}) - new(name:, + new(name: name, ensure: :present) end end diff --git a/spec/defines/server/pg_hba_rule_spec.rb b/spec/defines/server/pg_hba_rule_spec.rb index 302d2848e8..7d1187001c 100644 --- a/spec/defines/server/pg_hba_rule_spec.rb +++ b/spec/defines/server/pg_hba_rule_spec.rb @@ -25,7 +25,7 @@ class { 'postgresql::server': } user: 'all', address: '1.1.1.1/24', auth_method: 'md5', - target: + target: target } end @@ -47,7 +47,7 @@ class { 'postgresql::server': } database: 'all', user: 'all', auth_method: 'ident', - target: + target: target } end @@ -71,7 +71,7 @@ class { 'postgresql::server': } address: '0.0.0.0/0', auth_method: 'ldap', auth_option: 'foo=bar', - target: + target: target } end @@ -98,7 +98,7 @@ class { 'postgresql::server': } user: 'all', address: '0.0.0.0/0', auth_method: 'peer', - target: + target: target } end @@ -126,7 +126,7 @@ class { 'postgresql::server': } user: 'all', address: '0.0.0.0/0', auth_method: 'scram-sha-256', - target: + target: target } end @@ -240,7 +240,7 @@ class { 'postgresql::server': } user: 'all', address: '.domain.tld', auth_method: 'md5', - target: + target: target } end @@ -263,7 +263,7 @@ class { 'postgresql::server': } user: 'all', address: '/45', auth_method: 'md5', - target: + target: target } end diff --git a/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb b/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb index 5e3c705547..9f2c3b55e1 100644 --- a/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +++ b/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb @@ -5,7 +5,7 @@ describe Puppet::Type.type(:postgresql_psql).provider(:ruby) do let(:name) { 'rspec psql test' } let(:resource) do - Puppet::Type.type(:postgresql_psql).new({ name:, provider: :ruby }.merge(attributes)) + Puppet::Type.type(:postgresql_psql).new({ name: name, provider: :ruby }.merge(attributes)) end let(:provider) { resource.provider } diff --git a/spec/unit/puppet/provider/postgresql_replication_slot/ruby_spec.rb b/spec/unit/puppet/provider/postgresql_replication_slot/ruby_spec.rb index 676d783f18..032ceac752 100644 --- a/spec/unit/puppet/provider/postgresql_replication_slot/ruby_spec.rb +++ b/spec/unit/puppet/provider/postgresql_replication_slot/ruby_spec.rb @@ -20,7 +20,7 @@ def success? let(:name) { 'standby' } let(:resource) do - type.new({ name:, provider: :ruby }.merge(attributes)) + type.new({ name: name, provider: :ruby }.merge(attributes)) end let(:sql_instances) do "abc | | physical | | | t | | | 0/3000420 diff --git a/spec/unit/puppet/type/postgresql_psql_spec.rb b/spec/unit/puppet/type/postgresql_psql_spec.rb index ed8a3b1b4a..871645534d 100644 --- a/spec/unit/puppet/type/postgresql_psql_spec.rb +++ b/spec/unit/puppet/type/postgresql_psql_spec.rb @@ -132,7 +132,7 @@ [true, :true].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly: } + { refreshonly: refreshonly } end context 'not refreshing' @@ -141,7 +141,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly: } + { refreshonly: refreshonly } end context 'refreshing' @@ -152,7 +152,7 @@ [false, :false].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly: } + { refreshonly: refreshonly } end context 'not refreshing' @@ -161,7 +161,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly: } + { refreshonly: refreshonly } end context 'refreshing' @@ -176,7 +176,7 @@ [true, :true].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'not refreshing' @@ -185,7 +185,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'refreshing' @@ -196,7 +196,7 @@ [false, :false].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'not refreshing' @@ -205,7 +205,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'refreshing' @@ -220,7 +220,7 @@ [true, :true].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'not refreshing' @@ -229,7 +229,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'refreshing' @@ -240,7 +240,7 @@ [false, :false].each do |refreshonly| context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'not refreshing' @@ -249,7 +249,7 @@ context "refreshonly => #{refreshonly.inspect}" do let(:attributes) do - { refreshonly:, unless: 'SELECT something' } + { refreshonly: refreshonly, unless: 'SELECT something' } end context 'refreshing'