From 48b6344645edd77c4bb836521eb8026f5797099f Mon Sep 17 00:00:00 2001
From: nuex <nx@nu-ex.com>
Date: Mon, 17 Jun 2013 11:16:26 -0400
Subject: [PATCH] __postgres_role: check if state parameter exists before
 reading it

---
 cdist/conf/type/__postgres_role/gencode-remote | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cdist/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote
index 8fb2c91d..65a9d588 100755
--- a/cdist/conf/type/__postgres_role/gencode-remote
+++ b/cdist/conf/type/__postgres_role/gencode-remote
@@ -20,8 +20,8 @@
 
 name="$__object_id"
 state_is="$(cat "$__object/explorer/state")"
-state_should="$(cat "$__object/parameter/state")"
-[ ! "$state_should" ] && state_should="present"
+state_should="present"
+[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
 
 [ "$state_is" = "$state_should" ] && exit 0