From 3a7044e2b85a6452c90d492505d9b7b18c70cef6 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 30 Jul 2023 07:24:41 +1200 Subject: [PATCH] ejabberd_user: better error when command not installed (#7028) * ejabberd_user: better error when command not installed * add changelog frag --- changelogs/fragments/6949-ejabberdctl-error.yml | 2 ++ plugins/modules/ejabberd_user.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/6949-ejabberdctl-error.yml diff --git a/changelogs/fragments/6949-ejabberdctl-error.yml b/changelogs/fragments/6949-ejabberdctl-error.yml new file mode 100644 index 0000000000..be2294ffa3 --- /dev/null +++ b/changelogs/fragments/6949-ejabberdctl-error.yml @@ -0,0 +1,2 @@ +bugfixes: + - ejabberd_user - provide meaningful error message when the ``ejabberdctl`` command is not found (https://github.com/ansible-collections/community.general/pull/7028, https://github.com/ansible-collections/community.general/issues/6949). diff --git a/plugins/modules/ejabberd_user.py b/plugins/modules/ejabberd_user.py index 397207ae61..a8872cacc3 100644 --- a/plugins/modules/ejabberd_user.py +++ b/plugins/modules/ejabberd_user.py @@ -122,7 +122,7 @@ class EjabberdUser(object): """ This method will run the any command specified and return the returns using the Ansible common module """ - cmd = [self.module.get_bin_path('ejabberdctl'), cmd] + options + cmd = [self.module.get_bin_path('ejabberdctl', required=True), cmd] + options self.log('command: %s' % " ".join(cmd)) return self.module.run_command(cmd)