From 4e94aa78314aac95f394f84c0c3b6146cdd098a2 Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Wed, 21 Jun 2017 10:24:32 +0200 Subject: [PATCH] Fix states messages on creation of resources Show the "resource has beeen recreated" message only when that actually happened. Signed-off-by: Flavio Castelli --- salt/states/kubernetes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/states/kubernetes.py b/salt/states/kubernetes.py index 03df15ebd0..2ee79a6f1b 100644 --- a/salt/states/kubernetes.py +++ b/salt/states/kubernetes.py @@ -212,6 +212,7 @@ def deployment_present( # TODO: improve checks # pylint: disable=fixme log.info('Forcing the recreation of the deployment') + ret['comment'] = 'The deployment is already present. Forcing recreation' res = __salt__['kubernetes.replace_deployment']( name=name, namespace=namespace, @@ -226,7 +227,6 @@ def deployment_present( 'metadata': metadata, 'spec': spec } - ret['comment'] = 'The deployment is already present. Forcing recreation' ret['result'] = True return ret @@ -307,6 +307,7 @@ def service_present( # TODO: improve checks # pylint: disable=fixme log.info('Forcing the recreation of the service') + ret['comment'] = 'The service is already present. Forcing recreation' res = __salt__['kubernetes.replace_service']( name=name, namespace=namespace, @@ -322,7 +323,6 @@ def service_present( 'metadata': metadata, 'spec': spec } - ret['comment'] = 'The service is already present. Forcing recreation' ret['result'] = True return ret @@ -553,6 +553,7 @@ def secret_present( # TODO: improve checks # pylint: disable=fixme log.info('Forcing the recreation of the service') + ret['comment'] = 'The secret is already present. Forcing recreation' res = __salt__['kubernetes.replace_secret']( name=name, namespace=namespace, @@ -567,7 +568,6 @@ def secret_present( # and can contain sensitive data. 'data': data.keys() } - ret['comment'] = 'The secret is already present. Forcing recreation' ret['result'] = True return ret