From e23f4bf8e84c0b248ad4be21680aaf5b767ad683 Mon Sep 17 00:00:00 2001 From: Brian Jackson Date: Thu, 23 Apr 2015 12:04:20 -0500 Subject: [PATCH] Handle test=True correctly for tablespace owner We weren't handling test=True correctly for when the table already existed, but the owner was changing. --- _states/postgres_tablespace.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_states/postgres_tablespace.py b/_states/postgres_tablespace.py index fc3524f..bf0953c 100644 --- a/_states/postgres_tablespace.py +++ b/_states/postgres_tablespace.py @@ -79,7 +79,11 @@ def present(name, ret['result'] = False return ret # This isn't changeable, they need to remove/remake - if (not owner and not tblspaces[name]['Owner'] == owner): + if (owner and not tblspaces[name]['Owner'] == owner): + if __opts__['test']: + ret['result'] = None + ret['comment'] = 'Tablespace {0} owner to be altered'.format(name) + return ret if __salt__['postgres_ext.tablespace_alter'](name, new_owner=owner): ret['comment'] = 'Tablespace {0} owner changed'.format(name) ret['result'] = True