mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Show a better error message when there is too much arguments (#16119)
If someone run: ansible all -m file state=present The error message is "Missing target hosts" which is misleading, since the target hosts is here, the problem is the missing '-a'.
This commit is contained in:
parent
2bf2e0fdfd
commit
f07d6b26a7
1 changed files with 4 additions and 1 deletions
|
@ -74,9 +74,12 @@ class AdHocCLI(CLI):
|
|||
|
||||
self.options, self.args = self.parser.parse_args(self.args[1:])
|
||||
|
||||
if len(self.args) != 1:
|
||||
if len(self.args) < 1:
|
||||
raise AnsibleOptionsError("Missing target hosts")
|
||||
|
||||
if len(self.args) > 1:
|
||||
raise AnsibleOptionsError("Extranous options or arguments")
|
||||
|
||||
display.verbosity = self.options.verbosity
|
||||
self.validate_conflicts(runas_opts=True, vault_opts=True, fork_opts=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue