mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
capture some install issues and give out a slightly nicer error
This commit is contained in:
parent
46acf892d5
commit
e6b1dc45e1
1 changed files with 5 additions and 0 deletions
|
@ -36,6 +36,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from pkg_resources import DistributionNotFound
|
||||||
|
|
||||||
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
|
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
from ansible.utils.unicode import to_unicode
|
from ansible.utils.unicode import to_unicode
|
||||||
|
@ -98,6 +100,9 @@ if __name__ == '__main__':
|
||||||
except AnsibleError as e:
|
except AnsibleError as e:
|
||||||
display.error(to_unicode(e), wrap_text=False)
|
display.error(to_unicode(e), wrap_text=False)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except DistributionNotFound as e:
|
||||||
|
display.error("There is an issue with the Ansible installation: %s" % to_unicode(e))
|
||||||
|
sys.exit(10)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
display.error("User interrupted execution")
|
display.error("User interrupted execution")
|
||||||
sys.exit(99)
|
sys.exit(99)
|
||||||
|
|
Loading…
Reference in a new issue