Skip to content

Commit dd1e477

Browse files
author
Johan De Wit
committed
[Cleanup] remove version check, since we only support from 4 and higher now
1 parent 3a600e4 commit dd1e477

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

lib/puppet/provider/mongodb.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -234,30 +234,4 @@ def mongo_version
234234
self.class.mongo_version
235235
end
236236

237-
def self.mongo_4?
238-
v = mongo_version
239-
!v[%r{^4\.}].nil?
240-
end
241-
242-
def mongo_4?
243-
self.class.mongo_4?
244-
end
245-
246-
def self.mongo_5?
247-
v = mongo_version
248-
!v[%r{^5\.}].nil?
249-
end
250-
251-
def mongo_5?
252-
self.class.mongo_5?
253-
end
254-
255-
def self.mongo_6?
256-
v = mongo_version
257-
!v[%r{^6\.}].nil?
258-
end
259-
260-
def mongo_6?
261-
self.class.mongo_6?
262-
end
263237
end

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ def password=(value)
127127
digestPassword: true
128128
}
129129

130-
if mongo_4? || mongo_5? || mongo_6?
131-
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1']
132-
end
130+
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1']
133131

134132
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
135133
end

spec/unit/puppet/provider/mongodb_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
v.each do |key, results|
2424
it "version detection for [#{key}]" do
2525
allow(provider_class).to receive(:mongo_eval).with('db.version()').and_return(key)
26-
expect(provider_class.mongo_4?).to be results['4']
27-
expect(provider_class.mongo_5?).to be results['5']
28-
expect(provider_class.mongo_6?).to be results['6']
2926
end
3027
end
3128
end

0 commit comments

Comments
 (0)