Skip to content

Commit

Permalink
Update mongodb to fe562b86f388a6d107bb1f3cb3b32a3978f59c2a
Browse files Browse the repository at this point in the history
commit fe562b86f388a6d107bb1f3cb3b32a3978f59c2a
Merge: 7651365 34a9f7a
Author: Colleen Murphy <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date:   Fri Nov 21 19:23:08 2014 -0500

    0.9.0 prep

commit 8da88bed9f4d59e6582a2bd23c2c5ddd0a5d954d
Merge: d414ae5 ac0671e
Author: Morgan Haskel <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date:   Mon Oct 6 12:31:32 2014 +0200

    Fix spec for ruby 1.8

commit 5e229857c29bd44c9d812a21bed69098bf670a6a
Author: Amos Wood <[email protected]>
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 <[email protected]>
Date:   Tue Sep 23 14:39:25 2014 +0200

    Document the new mongodb_user parameter.

commit ecbc9e8db055ce96421a9a1af710b15b3cc60e62
Author: Marius Rieder <[email protected]>
Date:   Wed Sep 17 13:17:21 2014 +0200

    Set version to 2.6.x for spec

commit 9aacef2bc18ff37b5a81403af41b21b89dd9ceb0
Author: Marius Rieder <[email protected]>
Date:   Wed Sep 17 13:13:33 2014 +0200

    Add Mongodb 2.4.x compatibility for mongodb_user

commit ef47f9e788d222656e7c9fb45ef894ac16583bcb
Author: Marius Rieder <[email protected]>
Date:   Wed Sep 17 07:46:42 2014 +0200

    Fix specs for improved type providers

commit f63c781841684657df54e9546d12812e35bb66a1
Author: Marius Rieder <[email protected]>
Date:   Tue Sep 16 10:39:32 2014 +0200

    Reimplement mongodb_database provider based on Puppet::Provider::Mongodb

commit f66e963fb0f9092f07670c20a8465de86a2d787d
Author: Marius Rieder <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date:   Mon Sep 22 10:13:48 2014 -0700

    redux: revert key_server in apt repo

commit 50b46f7dc83da8d7980d8130d30be32bf0a87963
Merge: a138a1e 88c7f3c
Author: Amos Wood <[email protected]>
Date:   Mon Sep 22 10:09:53 2014 -0700

    Merge branch 'master' of https://github.com/amoswood/puppetlabs-mongodb

commit a138a1e0431fa348f274a4d6807933c22d4403bc
Author: Amos Wood <[email protected]>
Date:   Mon Sep 22 10:09:49 2014 -0700

    reset key_server to use "hkp"

commit b1d2779ab1bd3b3f6858e6714c3147c901b747ef
Author: Amos Wood <[email protected]>
Date:   Fri Sep 12 10:06:34 2014 -0500

    v2.6 config file template; custom config template

commit 4ec92eaad7eab8d88b0fe83f9e6af146629bd64c
Author: Amos Wood <[email protected]>
Date:   Wed Jul 23 12:28:03 2014 -0500

    change key_server to not brake apt

commit 2bbf8a7ee6ada5274d86913fa06c04131f68e9ed
Author: Amos Wood <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date:   Tue Sep 16 09:17:58 2014 +0200

    Add Puppet::Provider::Mongodb for shared provider code.

commit 88c7f3c8f069ec815524031916c9d857ca1ca191
Author: Amos Wood <[email protected]>
Date:   Fri Sep 12 10:06:34 2014 -0500

    v2.6 config file template; custom config template

commit a2c0fa5a4c389579db8589736047cb098c6353cc
Author: Amos Wood <[email protected]>
Date:   Wed Jul 23 12:28:03 2014 -0500

    change key_server to not brake apt

commit 5023e9b2339cd78c56484b5aa6bd4752ca931cc9
Author: Amos Wood <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date:   Fri Jul 11 14:37:34 2014 +0200

    Update README.md

commit 65fb18859752bbbbde51e7d4cc2b3ce17453445d
Author: Léo POIROUX <[email protected]>
Date:   Wed Jul 9 15:40:27 2014 +0200

    Update mongodb.conf.erb

commit 4484d742c18677c29b1843e70c1037b97f81de5b
Author: Léo POIROUX <[email protected]>
Date:   Wed Jul 9 15:38:41 2014 +0200

    Update server.pp

commit fde59d079da148f9259f92d71b3f6221dafb8659
Author: Léo POIROUX <[email protected]>
Date:   Wed Jul 9 15:37:14 2014 +0200

    Update config.pp

commit cbcb251b09cdb4f7a1587d86999b21dbc4e5d765
Author: Léo POIROUX <[email protected]>
Date:   Wed Jul 9 15:36:02 2014 +0200

    Update init.pp
  • Loading branch information
xbezdick committed Nov 28, 2014
1 parent 354e31f commit 55ba535
Show file tree
Hide file tree
Showing 23 changed files with 677 additions and 197 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod 'module-data',
:git => 'https://github.com/ripienaar/puppet-module-data.git'

mod 'mongodb',
:commit => '0518f864afcce2ebb79f1f2edab5de323c811af7',
:commit => 'fe562b86f388a6d107bb1f3cb3b32a3978f59c2a',
:git => 'https://github.com/puppetlabs/puppetlabs-mongodb.git'

mod 'mysql',
Expand Down
3 changes: 1 addition & 2 deletions mongodb/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Gemfile.lock
metadata.json
*.idea
*.swp
*.tmp
tmp/
pkg/
spec/fixtures/manifests
.rspec_system/
.vagrant/
.vagrant/
74 changes: 0 additions & 74 deletions mongodb/CHANGELOG

This file was deleted.

94 changes: 94 additions & 0 deletions mongodb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
##2014-11-25 - Release 0.9.0
###Summary

This release has a number of new parameters, support for 2.6, improved providers, and several bugfixes.

####Features
- New parameters: `mongodb::globals`
- `$service_ensure`
- `$service_enable`
- New parameters: `mongodb`
- `$quiet`
- New parameters: `mongodb::server`
- `$service_ensure`
- `$service_enable`
- `$quiet`
- `$config_content`
- Support for mongodb 2.6
- Reimplement `mongodb_user` and `mongodb_database` provider
- Added `mongodb_conn_validator` type

####Bugfixes
- Use hkp for the apt keyserver
- Fix mongodb database existance check
- Fix `$server_package_name` problem (MODULES-690)
- Make sure `pidfilepath` doesn't have any spaces
- Providers need the client command before they can work (MODULES-1285)

##2014-05-27 - Release 0.8.0
###Summary

This feature features a rewritten mongodb_replset{} provider, includes several
important bugfixes, ruby 1.8 support, and two new features.

####Features
- Rewritten mongodb_replset{}, featuring puppet resource support, prefetching,
and flushing.
- Add Ruby 1.8 compatibility.
- Adds `syslog`, allowing you to configure mongodb to send all logging to the hosts syslog.
- Add mongodb::replset, a wrapper class for hiera users.
- Improved testing!

####Bugfixes
- Fixes the package names to work since 10gen renamed them again.
- Fix provider name in the README.
- Disallow `nojournal` and `journal` to be set at the same time.
- Changed - to = for versioned install on Ubuntu.

##2014-1-29 - Release 0.7.0
###Summary

Added Replica Set Type and Provider

##2014-1-17 - Release 0.6.0
###Summary

Added support for installing MongoDB client on
RHEL family systems.

##2014-01-10 Release 0.5.0
###Summary

Added types for providers for Mongo users and databases.

##2013-12 Release 0.4.0

Major refactoring of the MongoDB module. Includes a new 'mongodb::globals'
that consolidates many shared parameters into one location. This is an
API-breaking release in anticipation of a 1.0 release.

##2013-10-31 - Release 0.3.0
###Summary

Adds a number of parameters and fixes some platform
specific bugs in module deployment.

##2013-09-25 - Release 0.2.0
###Summary

This release fixes a duplicate parameter.

####Bugfixes
- Fix a duplicated parameter.

##2012-07-13 - Release 0.1.0
- Add support for RHEL/CentOS
- Change default mongodb install location to OS repo

##2012-05-29 - Release 0.0.2
- Fix Modulefile typo.
- Remove repo pin.
- Update spec tests and add travis support.

##2012-05-03 - Release 0.0.1
- Initial Release.
1 change: 0 additions & 1 deletion mongodb/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ group :test, :development do
gem 'simplecov', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'vagrant-wrapper', :require => false
end

if puppetversion = ENV['PUPPET_VERSION']
Expand Down
12 changes: 0 additions & 12 deletions mongodb/Modulefile

This file was deleted.

16 changes: 14 additions & 2 deletions mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class {'::mongodb::server':

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

```
puppet class {'::mongodb::client':}
```puppet
class {'::mongodb::client':}
```

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

#####`quiet`
Runs the mongod or mongos instance in a quiet mode that attempts to limit the
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".
Default: false

> For production systems this option is **not** recommended as it may make tracking
problems during particular connections much more difficult.

#####`slowms`
Sets the threshold for mongod to consider a query “slow” for the database profiler.
Default: 100 ms
Expand Down Expand Up @@ -411,6 +419,7 @@ The maximum amount of two second tries to wait MongoDB startup. Default: 10

```puppet
mongodb_user { testuser:
username => 'testuser',
ensure => present,
password_hash => mongodb_password('testuser', 'p@ssw0rd'),
database => testdb,
Expand All @@ -419,6 +428,9 @@ mongodb_user { testuser:
require => Class['mongodb::server'],
}
```
#####`username`
Name of the mongodb user.

#####`password_hash`
Hex encoded md5 hash of "$username:mongo:$password".

Expand Down
54 changes: 54 additions & 0 deletions mongodb/lib/puppet/provider/mongodb.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Puppet::Provider::Mongodb < Puppet::Provider

# Without initvars commands won't work.
initvars
commands :mongo => 'mongo'

# Optional defaults file
def self.mongorc_file
if File.file?("#{Facter.value(:root_home)}/.mongorc.js")
"load('#{Facter.value(:root_home)}/.mongorc.js'); "
else
nil
end
end

def mongorc_file
self.class.mongorc_file
end

# Mongo Command Wrapper
def self.mongo_eval(cmd, db = 'admin')
if mongorc_file
cmd = mongorc_file + cmd
end

out = mongo([db, '--quiet', '--eval', cmd])

out.gsub!(/ObjectId\(([^)]*)\)/, '\1')
out
end

def mongo_eval(cmd, db = 'admin')
self.class.mongo_eval(cmd, db)
end

# Mongo Version checker
def self.mongo_version
@@mongo_version ||= self.mongo_eval('db.version()')
end

def mongo_version
self.class.mongo_version
end

def self.mongo_24?
v = self.mongo_version
! v[/^2\.4\./].nil?
end

def mongo_24?
self.class.mongo_24?
end

end
38 changes: 21 additions & 17 deletions mongodb/lib/puppet/provider/mongodb_database/mongodb.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
Puppet::Type.type(:mongodb_database).provide(:mongodb) do
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mongodb'))
Puppet::Type.type(:mongodb_database).provide(:mongodb, :parent => Puppet::Provider::Mongodb) do

desc "Manages MongoDB database."

defaultfor :kernel => 'Linux'

commands :mongo => 'mongo'

def block_until_mongodb(tries = 10)
begin
mongo('--quiet', '--eval', 'db.getMongo()')
rescue => e
debug('MongoDB server not ready, retrying')
sleep 2
if (tries -= 1) > 0
retry
else
raise e
def self.instances
require 'json'
dbs = JSON.parse mongo_eval('printjson(db.getMongo().getDBs())')

dbs['databases'].collect do |db|
new(:name => db['name'],
:ensure => :present)
end
end

# Assign prefetched dbs based on name.
def self.prefetch(resources)
dbs = instances
resources.keys.each do |name|
if provider = dbs.find { |db| db.name == name }
resources[name].provider = provider
end
end
end

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

def destroy
mongo(@resource[:name], '--quiet', '--eval', 'db.dropDatabase()')
mongo_eval('db.dropDatabase()', @resource[:name])
end

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

end
Loading

0 comments on commit 55ba535

Please sign in to comment.