summaryrefslogtreecommitdiff
path: root/bin/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ansible')
-rwxr-xr-xbin/ansible14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/ansible b/bin/ansible
index 7420c2cc30..60d2bf42cb 100755
--- a/bin/ansible
+++ b/bin/ansible
@@ -71,11 +71,15 @@ if __name__ == '__main__':
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
elif me == 'ansible':
from ansible.cli.adhoc import AdHocCLI as mycli
-
- cli = mycli(sys.argv, display=display)
- except (ImportError,NameError):
- raise AnsibleError("Ansible sub-program not implemented: %s" % me)
-
+ else:
+ raise AnsibleError("Unknown Ansible alias: %s" % me)
+ except ImportError as e:
+ if e.message.endswith(' %s' % sub):
+ raise AnsibleError("Ansible sub-program not implemented: %s" % me)
+ else:
+ raise
+
+ cli = mycli(sys.argv, display=display)
cli.parse()
sys.exit(cli.run())