From a5a89d49888aa6123b78c37b72ec34177f40dcaf Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 18 Sep 2013 16:51:04 +0200 Subject: use curl -f instead of curl | grep -v "error" curl -f will fail if a 400 or 500 response code is returned --- manifests/create_db.pp | 2 +- manifests/document.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/create_db.pp b/manifests/create_db.pp index 32bc974..9ba921c 100644 --- a/manifests/create_db.pp +++ b/manifests/create_db.pp @@ -8,7 +8,7 @@ define couchdb::create_db ( cmd => 'PUT', host => $host, path => $name, - unless => "/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc ${host}/${name} | grep -q -v '{\"error\":\"not_found\"'" + unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${host}/${name}" } couchdb::query { "${name}_security": diff --git a/manifests/document.pp b/manifests/document.pp index 2f6aac6..1153296 100644 --- a/manifests/document.pp +++ b/manifests/document.pp @@ -28,7 +28,7 @@ define couchdb::document( cmd => 'PUT', host => $host, path => "${db}/${id}", - unless => "/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc ${url} | grep -q -v '{\"error\":'" + unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${url}" } } @@ -37,7 +37,7 @@ define couchdb::document( cmd => 'DELETE', host => $host, path => "${db}/${id}", - unless => "/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc ${url} | grep -q '{\"error\":'" + unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${url}" } } } -- cgit v1.2.3