diff --git a/bin/ansible b/bin/ansible index 70e6863f6bf..085a8e0f4e6 100755 --- a/bin/ansible +++ b/bin/ansible @@ -74,12 +74,13 @@ if __name__ == '__main__': elif me == 'ansible-galaxy': from ansible.cli.galaxy import GalaxyCLI as mycli - cli = mycli(sys.argv, display=display) - if cli: - cli.parse() - sys.exit(cli.run()) - else: - raise AnsibleError("Program not implemented: %s" % me) + try: + cli = mycli(sys.argv, display=display) + except NameError: + raise AnsibleError("Ansible sub-program not implemented: %s" % me) + + cli.parse() + sys.exit(cli.run()) except AnsibleOptionsError as e: cli.parser.print_help()