Skip to content

Commit 61b00f2

Browse files
authored
Merge pull request #615 from xepa/issue.upstream#614
Add mongo 5.0 debian / ubuntu apt key
2 parents 7ded295 + 9e5c471 commit 61b00f2

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

lib/puppet/provider/mongodb.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,13 @@ def self.mongo_4?
183183
def mongo_4?
184184
self.class.mongo_4?
185185
end
186+
187+
def self.mongo_5?
188+
v = mongo_version
189+
!v[%r{^5\.}].nil?
190+
end
191+
192+
def mongo_5?
193+
self.class.mongo_5?
194+
end
186195
end

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def create
6161
digestPassword: false
6262
}
6363

64-
if mongo_4?
64+
if mongo_4? || mongo_5?
6565
# SCRAM-SHA-256 requires digestPassword to be true.
6666
command[:mechanisms] = ['SCRAM-SHA-1']
6767
end

manifests/repo.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
default => undef
5858
}
5959
$key = "${mongover[0]}.${mongover[1]}" ? {
60+
'5.0' => 'F5679A222C647C87527C2F8CB00A0BD1E2C63C11',
6061
'4.4' => '20691EEC35216C63CAF66CE1656408E390CFB1F5',
6162
'4.2' => 'E162F504A20CDF15827F718D4B7C549A058F8B6B',
6263
'4.0' => '9DA31620334BD75D9DCB49F368818C72E52529D4',
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
require 'puppet/provider/mongodb'
4+
5+
provider_class = Puppet::Provider::Mongodb
6+
describe provider_class do
7+
before do
8+
# Clear the cached version before each test
9+
provider_class.remove_instance_variable(:@mongo_version) \
10+
if provider_class.instance_variable_defined?(:@mongo_version)
11+
end
12+
13+
describe 'mongo version detection' do
14+
v = {
15+
'2.6.x' => { '26' => true, '4' => false, '5' => false },
16+
'4.x.x' => { '26' => false, '4' => true, '5' => false },
17+
'5.x.x' => { '26' => false, '4' => false, '5' => true },
18+
'x.x.x' => { '26' => false, '4' => false, '5' => false }
19+
}
20+
21+
v.each do |key, results|
22+
it "version detection for [#{key}]" do
23+
allow(provider_class).to receive(:mongo_eval).with('db.version()').and_return(key)
24+
expect(provider_class.mongo_26?).to be results['26']
25+
expect(provider_class.mongo_4?).to be results['4']
26+
expect(provider_class.mongo_5?).to be results['5']
27+
end
28+
end
29+
end
30+
end

0 commit comments

Comments
 (0)