summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2012-10-31 13:34:29 +0100
committervarac <varacanero@zeromail.org>2012-10-31 13:34:29 +0100
commit95beaab25a31a6b295d9c8ce809cc254a109e484 (patch)
tree5c2238ed499299b317b6d164713889df49d49ff6
parentb4020afadc24aa6c1da3a1b8b0b2aa7936353d1d (diff)
parent8e8d084b8eb8d74a47d2a29eaf15f6c5ac2aa0ed (diff)
Merge branch 'master' of git://github.com/camptocamp/puppet-couchdb
-rw-r--r--lib/puppet/parser/functions/couchdblookup.rb12
-rw-r--r--manifests/backup.pp19
2 files changed, 25 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/couchdblookup.rb b/lib/puppet/parser/functions/couchdblookup.rb
index 132c488..b9067d2 100644
--- a/lib/puppet/parser/functions/couchdblookup.rb
+++ b/lib/puppet/parser/functions/couchdblookup.rb
@@ -16,8 +16,16 @@ module Puppet::Parser::Functions
begin
json = JSON.parse(open(URI.parse(url)).read)
- rescue OpenURI::HTTPError, JSON::ParserError => error
- raise Puppet::ParseError, "couchdblookup(): fetching URL #{url} failed with status #{error.message}"
+ rescue OpenURI::HTTPError => error
+ raise Puppet::ParseError, "couchdblookup(): fetching URL #{url} failed with status '#{error.message}'"
+ rescue Timeout::Error => error
+ raise Puppet::ParseError, "couchdblookup(): connection to couchdb server timed out: '#{error.message}'"
+ rescue Errno::ECONNREFUSED => error
+ raise Puppet::ParseError, "couchdblookup(): connection to couchdb server failed: '#{error.message}'"
+ rescue JSON::ParserError => error
+ raise Puppet::ParseError, "couchdblookup(): failed to parse JSON received from couchdb: '#{error.message}'"
+ rescue StandardError => error
+ raise Puppet::ParseError, "couchdblookup(): something unexpected happened: '#{error.inspect}'"
end
result = nil
diff --git a/manifests/backup.pp b/manifests/backup.pp
index 14acff9..a880718 100644
--- a/manifests/backup.pp
+++ b/manifests/backup.pp
@@ -29,10 +29,21 @@ class couchdb::backup {
require => File["/usr/local/sbin/couchdb-backup.py"],
}
- # note: python-couchdb >= 0.8 required, which is found in debian wheezy.
- package { ["python-couchdb", "python-simplejson"]:
- ensure => present,
- before => File["/usr/local/sbin/couchdb-backup.py"],
+
+ case $operatingsystem {
+ /Debian|Ubunu/: {
+ # note: python-couchdb >= 0.8 required, which is found in debian wheezy.
+ package { ["python-couchdb", "python-simplejson"]:
+ ensure => present,
+ before => File["/usr/local/sbin/couchdb-backup.py"],
+ }
+ }
+ /RedHat|Centos/: {
+ exec {'install python-couchdb using easy_install':
+ command => 'easy_install http://pypi.python.org/packages/2.6/C/CouchDB/CouchDB-0.8-py2.6.egg',
+ creates => '/usr/lib/python2.6/site-packages/CouchDB-0.8-py2.6.egg',
+ }
+ }
}
}