summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2013-09-18 16:51:04 +0200
committerAzul <azul@riseup.net>2013-09-18 16:51:04 +0200
commita5a89d49888aa6123b78c37b72ec34177f40dcaf (patch)
treeace9383f8fc9d53e1e26c314f2555e0927d7c8e9
parentadbe5e98e61855c71d73539fa8dba917a82b111a (diff)
use curl -f instead of curl | grep -v "error"
curl -f will fail if a 400 or 500 response code is returned
-rw-r--r--manifests/create_db.pp2
-rw-r--r--manifests/document.pp4
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}"
}
}
}