From 6b5f03491205c7ea7738f531c4425629d450ffd0 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Mon, 1 Jun 2020 10:22:35 -0300
Subject: [PATCH] Fixes message when variable cannot be used in a given state
 action.

When using a variable that is invalid for a given action, the `action`
was not being displayed in the error message, leading to a poor user
experience.
---
 plugins/modules/ipaservice.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/modules/ipaservice.py b/plugins/modules/ipaservice.py
index e0da817c..9468e9dd 100644
--- a/plugins/modules/ipaservice.py
+++ b/plugins/modules/ipaservice.py
@@ -304,8 +304,8 @@ def check_parameters(module, state, action, names, parameters):
     for _invalid in invalid:
         if parameters[_invalid] is not None:
             module.fail_json(
-                msg="Argument '%s' can not be used with state '%s'" %
-                (_invalid, state))
+                msg="Argument '%s' can not be used with state '%s', "
+                "action '%s'" % (_invalid, state, action))
 
 
 def init_ansible_module():
-- 
GitLab