Skip to content

Commit 33756aa

Browse files
committed
Update mongodb to fe562b86f388a6d107bb1f3cb3b32a3978f59c2a
commit fe562b86f388a6d107bb1f3cb3b32a3978f59c2a Merge: 7651365 34a9f7a Author: Colleen Murphy <cmurphy@users.noreply.github.com> Date: Wed Nov 26 10:39:54 2014 -0800 Merge pull request redhat-openstack#149 from mhaskel/typo typo fix commit 34a9f7aea3d513282b3de2190709c61522554dcd Author: Morgan Haskel <morgan@puppetlabs.com> Date: Wed Nov 26 13:37:36 2014 -0500 typo fix The lack of trailing commas in json strikes again. commit 7651365ec5cdcd74909ff79317426b1b7d55d1a9 Merge: 8da88be aeb3bfe Author: Travis Fields <cyberious@users.noreply.github.com> Date: Fri Nov 21 19:25:43 2014 -0500 Merge pull request redhat-openstack#146 from mhaskel/0.9.0-prep 0.9.0 prep commit aeb3bfe100f94048a20c1d75013bc4131a27f1ff Author: Morgan Haskel <morgan@puppetlabs.com> Date: Fri Nov 21 19:23:08 2014 -0500 0.9.0 prep commit 8da88bed9f4d59e6582a2bd23c2c5ddd0a5d954d Merge: d414ae5 ac0671e Author: Morgan Haskel <morgan@puppetlabs.com> Date: Fri Nov 21 19:15:01 2014 -0500 Merge pull request redhat-openstack#145 from laurenrother/summary Add metadata summary to Modulefile per FM-1523 commit ac0671e89764f59c16deefe0cde803a6856c2435 Author: Lauren Rother <lauren.rother@puppetlabs.com> Date: Thu Nov 20 15:57:32 2014 -0800 Add metadata summary to Modulefile per FM-1523 commit d414ae577777ed288bab7485c8db73638c21f7ba Merge: a4d5936 a1c73c8 Author: Hunter Haugen <hunter@puppetlabs.com> Date: Thu Nov 20 10:53:37 2014 -0800 Merge pull request redhat-openstack#129 from leopoiroux/master Added "quiet" on mongo.conf commit a4d593690b5fad43a0688e5848b2e2b7c6ab5b88 Merge: 75d5da2 c8bbac7 Author: Morgan Haskel <morgan@puppetlabs.com> Date: Thu Nov 20 13:40:58 2014 -0500 Merge pull request redhat-openstack#142 from fnaard/fix_typo_in_readme Fix typo in README so that puppet code formatting gets applied. commit 75d5da27b32c1929c21f2a7cd1c8640dbdb2f8a4 Merge: d8134e3 407093c Author: Hunter Haugen <hunter@puppetlabs.com> Date: Thu Nov 20 10:40:48 2014 -0800 Merge pull request redhat-openstack#144 from synyx/master Fixed params.pp commit d8134e3cfd164aeca851d4a7abcb28edcfb750dc Merge: 3dd7699 3fc5835 Author: Hunter Haugen <hunter@puppetlabs.com> Date: Thu Nov 20 10:38:03 2014 -0800 Merge pull request redhat-openstack#138 from ninech/auth Workaround to enable mongodb_user/database to work with authentication. commit 407093c32d6a61a8c6e908e8233db4d1e985b123 Author: Johannes Graf <graf@synyx.de> Date: Thu Nov 13 18:12:48 2014 +0100 Fixed params.pp There are two issues on Debian based distributions using mongodb.org packages: ```puppet class {'::mongodb::globals': manage_package_repo => true, }-> class {'::mongodb::server':}-> class {'::mongodb::client':} ``` ### $config is undef for mongodb config unter /etc Error: Parameter path failed on File[undef]: File paths must be fully qualified, not 'undef' at /etc/puppet/modules/mongodb/manifests/server/config.pp:83 ### $service_name is `mongodb` instead of `mongod` Error: /Stage[main]/Mongodb::Server::Service/Service[mongodb]: Could not evaluate: Could not find init script or upstart conf file for 'mongodb' Error: /Stage[main]/Mongodb::Server::Service/Service[mongodb]: Failed to call refresh: Could not find init script or upstart conf file for 'mongodb' Error: /Stage[main]/Mongodb::Server::Service/Service[mongodb]: Could not find init script or upstart conf file for 'mongodb' Warning: /Stage[main]/Mongodb::Server::Service/Mongodb_conn_validator[mongodb]: Skipping because of failed dependencies Warning: /Stage[main]/Mongodb::Server/Anchor[mongodb::server::end]: Skipping because of failed dependencies commit 3dd76996523b0ebf95a8655d781bc8752040eb2b Merge: 0518f86 5e22985 Author: Hunter Haugen <hunter@puppetlabs.com> Date: Wed Nov 12 12:26:06 2014 -0800 Merge pull request redhat-openstack#139 from amoswood/master Mongo 2.6 version and config support commit c8bbac708385e698418666c44edce3b148126d17 Author: Gabriel M Schuyler <gabe@puppetlabs.com> Date: Mon Oct 27 15:30:58 2014 -0700 Fix typo in README so that puppet code formatting gets applied. commit 3fc583511dde45c7e30126e0480a2700b2ad1206 Author: Marius Rieder <marius.rieder@durchmesser.ch> Date: Mon Oct 6 12:31:32 2014 +0200 Fix spec for ruby 1.8 commit 5e229857c29bd44c9d812a21bed69098bf670a6a Author: Amos Wood <amos.wood@lifeway.com> Date: Wed Sep 24 11:23:33 2014 -0700 params and globals improvements and clean-up for 2.6 support commit c43964f13e3d11be8c0becc34a7a2fbd397d7963 Author: Marius Rieder <marius.rieder@durchmesser.ch> Date: Tue Sep 23 14:39:25 2014 +0200 Document the new mongodb_user parameter. commit ecbc9e8db055ce96421a9a1af710b15b3cc60e62 Author: Marius Rieder <marius.rieder@nine.ch> Date: Wed Sep 17 13:17:21 2014 +0200 Set version to 2.6.x for spec commit 9aacef2bc18ff37b5a81403af41b21b89dd9ceb0 Author: Marius Rieder <marius.rieder@nine.ch> Date: Wed Sep 17 13:13:33 2014 +0200 Add Mongodb 2.4.x compatibility for mongodb_user commit ef47f9e788d222656e7c9fb45ef894ac16583bcb Author: Marius Rieder <marius.rieder@durchmesser.ch> Date: Wed Sep 17 07:46:42 2014 +0200 Fix specs for improved type providers commit f63c781841684657df54e9546d12812e35bb66a1 Author: Marius Rieder <marius.rieder@nine.ch> Date: Tue Sep 16 10:39:32 2014 +0200 Reimplement mongodb_database provider based on Puppet::Provider::Mongodb commit f66e963fb0f9092f07670c20a8465de86a2d787d Author: Marius Rieder <marius.rieder@nine.ch> Date: Tue Sep 16 10:19:40 2014 +0200 Reimplement mongodb_user provider Based on Puppet::Provider::Mongodb for mongodb 2.6.x commit c3662503b9c45fcb792badb1cbb9c72556acef3b Author: Marius Rieder <marius.rieder@nine.ch> Date: Tue Sep 16 10:18:23 2014 +0200 Add a username property to mongodb_user. This allows to have users with the same name in different databases. commit f8732d6b512b793c34524393e0ed4d596e22589d Author: Marius Rieder <marius.rieder@nine.ch> Date: Tue Sep 16 10:15:40 2014 +0200 Addapt mongodb types to allow resource listing. database is a property not a parameter database default to test, not to fail anymore password_hash default to false, not to fail anymore commit 31f3baa8539dd91b445f2b9bb4fc8c40d5e3a544 Author: Amos Wood <amos.wood@lifeway.com> Date: Mon Sep 22 10:13:48 2014 -0700 redux: revert key_server in apt repo commit 50b46f7dc83da8d7980d8130d30be32bf0a87963 Merge: a138a1e 88c7f3c Author: Amos Wood <amos.wood@lifeway.com> Date: Mon Sep 22 10:09:53 2014 -0700 Merge branch 'master' of https://github.com/amoswood/puppetlabs-mongodb commit a138a1e0431fa348f274a4d6807933c22d4403bc Author: Amos Wood <amos.wood@lifeway.com> Date: Mon Sep 22 10:09:49 2014 -0700 reset key_server to use "hkp" commit b1d2779ab1bd3b3f6858e6714c3147c901b747ef Author: Amos Wood <amos.wood@lifeway.com> Date: Fri Sep 12 10:06:34 2014 -0500 v2.6 config file template; custom config template commit 4ec92eaad7eab8d88b0fe83f9e6af146629bd64c Author: Amos Wood <amos.wood@lifeway.com> Date: Wed Jul 23 12:28:03 2014 -0500 change key_server to not brake apt commit 2bbf8a7ee6ada5274d86913fa06c04131f68e9ed Author: Amos Wood <amos.wood@lifeway.com> Date: Mon Jun 23 09:49:11 2014 -0500 Fixed puppet management of configuration file In versions 2.4 and 2.6, the default configuration file name for Debian changed and was not captured in the params.pp file. commit 3e7176e099094f2a5608be2dbfd36a00c6301ec6 Author: Amos Wood <amos.wood@lifeway.com> Date: Fri Jun 20 16:28:23 2014 +0000 allowed server and client to properly use globals::version. Included Debian support for pre 2.6 and post 2.6 package names commit d73f8731324adc72c71af533590e1878d9e7ab8a Author: Marius Rieder <marius.rieder@nine.ch> Date: Tue Sep 16 09:17:58 2014 +0200 Add Puppet::Provider::Mongodb for shared provider code. commit 88c7f3c8f069ec815524031916c9d857ca1ca191 Author: Amos Wood <amos.wood@lifeway.com> Date: Fri Sep 12 10:06:34 2014 -0500 v2.6 config file template; custom config template commit a2c0fa5a4c389579db8589736047cb098c6353cc Author: Amos Wood <amos.wood@lifeway.com> Date: Wed Jul 23 12:28:03 2014 -0500 change key_server to not brake apt commit 5023e9b2339cd78c56484b5aa6bd4752ca931cc9 Author: Amos Wood <amos.wood@lifeway.com> Date: Mon Jun 23 09:49:11 2014 -0500 Fixed puppet management of configuration file In versions 2.4 and 2.6, the default configuration file name for Debian changed and was not captured in the params.pp file. commit 2b5b066a3d2652102e897ca7978164afa5426834 Author: Amos Wood <amos.wood@lifeway.com> Date: Fri Jun 20 16:28:23 2014 +0000 allowed server and client to properly use globals::version. Included Debian support for pre 2.6 and post 2.6 package names commit a1c73c87c3b76283e41ed9cf08a6782c4aeda1aa Author: Léo POIROUX <leo.poiroux@gmail.com> Date: Fri Jul 11 14:37:34 2014 +0200 Update README.md commit 65fb18859752bbbbde51e7d4cc2b3ce17453445d Author: Léo POIROUX <leo.poiroux@gmail.com> Date: Wed Jul 9 15:40:27 2014 +0200 Update mongodb.conf.erb commit 4484d742c18677c29b1843e70c1037b97f81de5b Author: Léo POIROUX <leo.poiroux@gmail.com> Date: Wed Jul 9 15:38:41 2014 +0200 Update server.pp commit fde59d079da148f9259f92d71b3f6221dafb8659 Author: Léo POIROUX <leo.poiroux@gmail.com> Date: Wed Jul 9 15:37:14 2014 +0200 Update config.pp commit cbcb251b09cdb4f7a1587d86999b21dbc4e5d765 Author: Léo POIROUX <leo.poiroux@gmail.com> Date: Wed Jul 9 15:36:02 2014 +0200 Update init.pp
1 parent 96e3ce2 commit 33756aa

23 files changed

Lines changed: 677 additions & 197 deletions

File tree

Puppetfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod 'module-data',
7171
:git => 'https://github.com/ripienaar/puppet-module-data.git'
7272

7373
mod 'mongodb',
74-
:commit => '0518f864afcce2ebb79f1f2edab5de323c811af7',
74+
:commit => 'fe562b86f388a6d107bb1f3cb3b32a3978f59c2a',
7575
:git => 'https://github.com/puppetlabs/puppetlabs-mongodb.git'
7676

7777
mod 'mysql',

mongodb/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
Gemfile.lock
2-
metadata.json
32
*.idea
43
*.swp
54
*.tmp
65
tmp/
76
pkg/
87
spec/fixtures/manifests
98
.rspec_system/
10-
.vagrant/
9+
.vagrant/

mongodb/CHANGELOG

Lines changed: 0 additions & 74 deletions
This file was deleted.

mongodb/CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
##2014-11-25 - Release 0.9.0
2+
###Summary
3+
4+
This release has a number of new parameters, support for 2.6, improved providers, and several bugfixes.
5+
6+
####Features
7+
- New parameters: `mongodb::globals`
8+
- `$service_ensure`
9+
- `$service_enable`
10+
- New parameters: `mongodb`
11+
- `$quiet`
12+
- New parameters: `mongodb::server`
13+
- `$service_ensure`
14+
- `$service_enable`
15+
- `$quiet`
16+
- `$config_content`
17+
- Support for mongodb 2.6
18+
- Reimplement `mongodb_user` and `mongodb_database` provider
19+
- Added `mongodb_conn_validator` type
20+
21+
####Bugfixes
22+
- Use hkp for the apt keyserver
23+
- Fix mongodb database existance check
24+
- Fix `$server_package_name` problem (MODULES-690)
25+
- Make sure `pidfilepath` doesn't have any spaces
26+
- Providers need the client command before they can work (MODULES-1285)
27+
28+
##2014-05-27 - Release 0.8.0
29+
###Summary
30+
31+
This feature features a rewritten mongodb_replset{} provider, includes several
32+
important bugfixes, ruby 1.8 support, and two new features.
33+
34+
####Features
35+
- Rewritten mongodb_replset{}, featuring puppet resource support, prefetching,
36+
and flushing.
37+
- Add Ruby 1.8 compatibility.
38+
- Adds `syslog`, allowing you to configure mongodb to send all logging to the hosts syslog.
39+
- Add mongodb::replset, a wrapper class for hiera users.
40+
- Improved testing!
41+
42+
####Bugfixes
43+
- Fixes the package names to work since 10gen renamed them again.
44+
- Fix provider name in the README.
45+
- Disallow `nojournal` and `journal` to be set at the same time.
46+
- Changed - to = for versioned install on Ubuntu.
47+
48+
##2014-1-29 - Release 0.7.0
49+
###Summary
50+
51+
Added Replica Set Type and Provider
52+
53+
##2014-1-17 - Release 0.6.0
54+
###Summary
55+
56+
Added support for installing MongoDB client on
57+
RHEL family systems.
58+
59+
##2014-01-10 Release 0.5.0
60+
###Summary
61+
62+
Added types for providers for Mongo users and databases.
63+
64+
##2013-12 Release 0.4.0
65+
66+
Major refactoring of the MongoDB module. Includes a new 'mongodb::globals'
67+
that consolidates many shared parameters into one location. This is an
68+
API-breaking release in anticipation of a 1.0 release.
69+
70+
##2013-10-31 - Release 0.3.0
71+
###Summary
72+
73+
Adds a number of parameters and fixes some platform
74+
specific bugs in module deployment.
75+
76+
##2013-09-25 - Release 0.2.0
77+
###Summary
78+
79+
This release fixes a duplicate parameter.
80+
81+
####Bugfixes
82+
- Fix a duplicated parameter.
83+
84+
##2012-07-13 - Release 0.1.0
85+
- Add support for RHEL/CentOS
86+
- Change default mongodb install location to OS repo
87+
88+
##2012-05-29 - Release 0.0.2
89+
- Fix Modulefile typo.
90+
- Remove repo pin.
91+
- Update spec tests and add travis support.
92+
93+
##2012-05-03 - Release 0.0.1
94+
- Initial Release.

mongodb/Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ group :test, :development do
1010
gem 'simplecov', :require => false
1111
gem 'beaker', :require => false
1212
gem 'beaker-rspec', :require => false
13-
gem 'vagrant-wrapper', :require => false
1413
end
1514

1615
if puppetversion = ENV['PUPPET_VERSION']

mongodb/Modulefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

mongodb/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class {'::mongodb::server':
6262

6363
For Red Hat family systems, the client can be installed in a similar fashion:
6464

65-
```
66-
puppet class {'::mongodb::client':}
65+
```puppet
66+
class {'::mongodb::client':}
6767
```
6868

6969
Note that for Debian/Ubuntu family systems the client is installed with the
@@ -335,6 +335,14 @@ set name as an argument to this set. All hosts must have the same set name.
335335
#####`rest`
336336
Set to true to enable a simple REST interface. Default: false
337337

338+
#####`quiet`
339+
Runs the mongod or mongos instance in a quiet mode that attempts to limit the
340+
amount of output. This option suppresses : "output from database commands, including drop, dropIndexes, diagLogging, validate, and clean", "replication activity", "connection accepted events" and "connection closed events".
341+
Default: false
342+
343+
> For production systems this option is **not** recommended as it may make tracking
344+
problems during particular connections much more difficult.
345+
338346
#####`slowms`
339347
Sets the threshold for mongod to consider a query “slow” for the database profiler.
340348
Default: 100 ms
@@ -411,6 +419,7 @@ The maximum amount of two second tries to wait MongoDB startup. Default: 10
411419

412420
```puppet
413421
mongodb_user { testuser:
422+
username => 'testuser',
414423
ensure => present,
415424
password_hash => mongodb_password('testuser', 'p@ssw0rd'),
416425
database => testdb,
@@ -419,6 +428,9 @@ mongodb_user { testuser:
419428
require => Class['mongodb::server'],
420429
}
421430
```
431+
#####`username`
432+
Name of the mongodb user.
433+
422434
#####`password_hash`
423435
Hex encoded md5 hash of "$username:mongo:$password".
424436

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
class Puppet::Provider::Mongodb < Puppet::Provider
2+
3+
# Without initvars commands won't work.
4+
initvars
5+
commands :mongo => 'mongo'
6+
7+
# Optional defaults file
8+
def self.mongorc_file
9+
if File.file?("#{Facter.value(:root_home)}/.mongorc.js")
10+
"load('#{Facter.value(:root_home)}/.mongorc.js'); "
11+
else
12+
nil
13+
end
14+
end
15+
16+
def mongorc_file
17+
self.class.mongorc_file
18+
end
19+
20+
# Mongo Command Wrapper
21+
def self.mongo_eval(cmd, db = 'admin')
22+
if mongorc_file
23+
cmd = mongorc_file + cmd
24+
end
25+
26+
out = mongo([db, '--quiet', '--eval', cmd])
27+
28+
out.gsub!(/ObjectId\(([^)]*)\)/, '\1')
29+
out
30+
end
31+
32+
def mongo_eval(cmd, db = 'admin')
33+
self.class.mongo_eval(cmd, db)
34+
end
35+
36+
# Mongo Version checker
37+
def self.mongo_version
38+
@@mongo_version ||= self.mongo_eval('db.version()')
39+
end
40+
41+
def mongo_version
42+
self.class.mongo_version
43+
end
44+
45+
def self.mongo_24?
46+
v = self.mongo_version
47+
! v[/^2\.4\./].nil?
48+
end
49+
50+
def mongo_24?
51+
self.class.mongo_24?
52+
end
53+
54+
end
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
1-
Puppet::Type.type(:mongodb_database).provide(:mongodb) do
1+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mongodb'))
2+
Puppet::Type.type(:mongodb_database).provide(:mongodb, :parent => Puppet::Provider::Mongodb) do
23

34
desc "Manages MongoDB database."
45

56
defaultfor :kernel => 'Linux'
67

7-
commands :mongo => 'mongo'
8-
9-
def block_until_mongodb(tries = 10)
10-
begin
11-
mongo('--quiet', '--eval', 'db.getMongo()')
12-
rescue => e
13-
debug('MongoDB server not ready, retrying')
14-
sleep 2
15-
if (tries -= 1) > 0
16-
retry
17-
else
18-
raise e
8+
def self.instances
9+
require 'json'
10+
dbs = JSON.parse mongo_eval('printjson(db.getMongo().getDBs())')
11+
12+
dbs['databases'].collect do |db|
13+
new(:name => db['name'],
14+
:ensure => :present)
15+
end
16+
end
17+
18+
# Assign prefetched dbs based on name.
19+
def self.prefetch(resources)
20+
dbs = instances
21+
resources.keys.each do |name|
22+
if provider = dbs.find { |db| db.name == name }
23+
resources[name].provider = provider
1924
end
2025
end
2126
end
2227

2328
def create
24-
mongo(@resource[:name], '--quiet', '--eval', "db.dummyData.insert({\"created_by_puppet\": 1})")
29+
mongo_eval('db.dummyData.insert({"created_by_puppet": 1})', @resource[:name])
2530
end
2631

2732
def destroy
28-
mongo(@resource[:name], '--quiet', '--eval', 'db.dropDatabase()')
33+
mongo_eval('db.dropDatabase()', @resource[:name])
2934
end
3035

3136
def exists?
32-
block_until_mongodb(@resource[:tries])
33-
mongo("--quiet", "--eval", 'db.getMongo().getDBNames()').chomp.split(",").include?(@resource[:name])
37+
!(@property_hash[:ensure] == :absent or @property_hash[:ensure].nil?)
3438
end
3539

3640
end

0 commit comments

Comments
 (0)