mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Do not use str() on exceptions (#46950)
This commit is contained in:
parent
2436aa1a4e
commit
a80c25cbd9
30 changed files with 76 additions and 66 deletions
|
@ -39,7 +39,7 @@ from ansible.galaxy.api import GalaxyAPI
|
|||
from ansible.galaxy.login import GalaxyLogin
|
||||
from ansible.galaxy.role import GalaxyRole
|
||||
from ansible.galaxy.token import GalaxyToken
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.playbook.role.requirement import RoleRequirement
|
||||
|
||||
try:
|
||||
|
@ -361,7 +361,7 @@ class GalaxyCLI(CLI):
|
|||
raise AnsibleError("Invalid role requirements file")
|
||||
f.close()
|
||||
except (IOError, OSError) as e:
|
||||
raise AnsibleError('Unable to open %s: %s' % (role_file, str(e)))
|
||||
raise AnsibleError('Unable to open %s: %s' % (role_file, to_native(e)))
|
||||
else:
|
||||
# roles were specified directly, so we'll just go out grab them
|
||||
# (and their dependencies, unless the user doesn't want us to).
|
||||
|
@ -397,7 +397,7 @@ class GalaxyCLI(CLI):
|
|||
try:
|
||||
installed = role.install()
|
||||
except AnsibleError as e:
|
||||
display.warning("- %s was NOT installed successfully: %s " % (role.name, str(e)))
|
||||
display.warning(u"- %s was NOT installed successfully: %s " % (role.name, to_text(e)))
|
||||
self.exit_without_ignore()
|
||||
continue
|
||||
|
||||
|
@ -451,7 +451,7 @@ class GalaxyCLI(CLI):
|
|||
else:
|
||||
display.display('- %s is not installed, skipping.' % role_name)
|
||||
except Exception as e:
|
||||
raise AnsibleError("Failed to remove role %s: %s" % (role_name, str(e)))
|
||||
raise AnsibleError("Failed to remove role %s: %s" % (role_name, to_native(e)))
|
||||
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue