From 24515e40ad289552d45bddd33c7a0dda93117a7f Mon Sep 17 00:00:00 2001 From: Thomas Woerner Date: Wed, 18 Dec 2019 12:28:03 +0100 Subject: [PATCH] ipahost: Enhanced failure msg for member params used without member action The failure message if member parameters like certificate, managedby_host, principal, allow_create_keytab_* and allow_retrieve_keytab_* are used without member action for state absent has been enhanced to propose the member action. --- plugins/modules/ipahost.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/modules/ipahost.py b/plugins/modules/ipahost.py index ec5e196..8ee9532 100644 --- a/plugins/modules/ipahost.py +++ b/plugins/modules/ipahost.py @@ -511,19 +511,25 @@ def check_parameters( "userclass", "auth_ind", "requires_pre_auth", "ok_as_delegate", "ok_to_auth_as_delegate", "force", "reverse", "ip_address", "update_password"] + for x in invalid: + if vars()[x] is not None: + module.fail_json( + msg="Argument '%s' can not be used with state '%s'" % + (x, state)) if action == "host": - invalid.extend([ + invalid = [ "certificate", "managedby_host", "principal", "allow_create_keytab_user", "allow_create_keytab_group", "allow_create_keytab_host", "allow_create_keytab_hostgroup", "allow_retrieve_keytab_user", "allow_retrieve_keytab_group", "allow_retrieve_keytab_host", - "allow_retrieve_keytab_hostgroup"]) - for x in invalid: - if vars()[x] is not None: - module.fail_json( - msg="Argument '%s' can not be used with state '%s'" % - (x, state)) + "allow_retrieve_keytab_hostgroup" + ] + for x in invalid: + if vars()[x] is not None: + module.fail_json( + msg="Argument '%s' can only be used with action " + "'member' for state '%s'" % (x, state)) def main():