Skip to content

Commit

Permalink
rubocop corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
traylenator committed Oct 3, 2023
1 parent d2f95fe commit 7cd4c06
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def self.conn_string
ip_real = case first_ip_in_list
when '0.0.0.0'
Facter.value(:fqdn)
when %r{\[?::0\]?} # rubocop:disable Lint/DuplicateBranch
when %r{\[?::0\]?}
Facter.value(:fqdn)
else
first_ip_in_list
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/mongodb_replset/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def master_host(members)
end

def self.replset_properties
conn_string = conn_string # rubocop:disable Lint/SelfAssignment
conn_string = conn_string
begin
output = mongo_command('rs.conf()', conn_string)
rescue Puppet::ExecutionFailure
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/mongodb_user/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def create
}

if mongo_4? || mongo_5?
if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
if @resource[:auth_mechanism] == :scram_sha_256
command[:mechanisms] = ['SCRAM-SHA-256']
command[:pwd] = @resource[:password]
command[:digestPassword] = true
Expand Down Expand Up @@ -121,7 +121,7 @@ def password=(value)
}

if mongo_4? || mongo_5?
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1'] # rubocop:disable Naming/VariableNumber
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1']
end

mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet/type/mongodb_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ def to_s?(_value = @is)
end

def insync?(_is)
return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256

should_to_s == to_s?
end
end

newparam(:auth_mechanism) do
desc 'Authentication mechanism. Password verification is not supported with SCRAM-SHA-256.'
defaultto :scram_sha_1 # rubocop:disable Naming/VariableNumber
newvalues(:scram_sha_256, :scram_sha_1) # rubocop:disable Naming/VariableNumber
defaultto :scram_sha_1
newvalues(:scram_sha_256, :scram_sha_1)
end

newparam(:update_password, boolean: true) do
Expand Down Expand Up @@ -126,7 +126,7 @@ def insync?(_is)
err("Either 'password_hash' or 'password' should be provided")
elsif !self[:password_hash].nil? && !self[:password].nil?
err("Only one of 'password_hash' or 'password' should be provided")
elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256
err("'password_hash' is not supported with SCRAM-SHA-256 authentication mechanism")
end
raise("The parameter 'scram_credentials' is read-only and cannot be changed") if should(:scram_credentials)
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/mongos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class { 'mongodb::server':
it { is_expected.to be_running }
end

describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_017) do
it { is_expected.to be_listening }
end

describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_019) do
it { is_expected.to be_listening }
end

Expand Down Expand Up @@ -90,11 +90,11 @@ class { 'mongodb::mongos':
it { is_expected.not_to be_running }
end

describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_017) do
it { is_expected.not_to be_listening }
end

describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_019) do
it { is_expected.not_to be_listening }
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ class { 'mongodb::server':
it { is_expected.not_to be_running }
end

describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_017) do
it { is_expected.not_to be_listening }
end

describe port(27_018) do # rubocop:disable RSpec/RepeatedExampleGroupBody
describe port(27_018) do
it { is_expected.not_to be_listening }
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@

context 'when setting up replicasets' do
describe 'should setup using replset_config' do
let(:rsConf) do # rubocop:disable RSpec/VariableName
let(:rsConf) do
{
'rsTest' => {
'members' => [
Expand All @@ -564,7 +564,7 @@
end

describe 'should setup using replset_members' do
let(:rsConf) do # rubocop:disable RSpec/VariableName
let(:rsConf) do
{
'rsTest' => {
'ensure' => 'present',
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
end

describe 'destroy' do
it 'removes a shard' do # rubocop:disable Lint/EmptyBlock
it 'removes a shard' do
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/util/mongodb_output_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper' # rubocop:todo Style/FrozenStringLiteralComment Frozen strings break the regex below
require 'spec_helper' # Frozen strings break the regex below
require 'puppet/util/mongodb_output'
require 'json'

Expand Down

0 comments on commit 7cd4c06

Please sign in to comment.