Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
0526b43b
Commit
0526b43b
authored
Oct 15, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12757 from mgedmin/py3k
Python 3: fix AnsibleError formatting
parents
d0ecceea
ab569cea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
lib/ansible/errors/__init__.py
+3
-4
lib/ansible/utils/unicode.py
+7
-0
No files found.
lib/ansible/errors/__init__.py
View file @
0526b43b
...
@@ -19,10 +19,9 @@
...
@@ -19,10 +19,9 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
import
os
from
ansible.errors.yaml_strings
import
*
from
ansible.errors.yaml_strings
import
*
from
ansible.utils.unicode
import
to_unicode
,
to_bytes
from
ansible.utils.unicode
import
to_unicode
,
to_str
class
AnsibleError
(
Exception
):
class
AnsibleError
(
Exception
):
'''
'''
...
@@ -49,7 +48,7 @@ class AnsibleError(Exception):
...
@@ -49,7 +48,7 @@ class AnsibleError(Exception):
if
obj
and
isinstance
(
obj
,
AnsibleBaseYAMLObject
):
if
obj
and
isinstance
(
obj
,
AnsibleBaseYAMLObject
):
extended_error
=
self
.
_get_extended_error
()
extended_error
=
self
.
_get_extended_error
()
if
extended_error
:
if
extended_error
:
self
.
message
=
'ERROR!
%
s
\n\n
%
s'
%
(
message
,
to_
bytes
(
extended_error
))
self
.
message
=
'ERROR!
%
s
\n\n
%
s'
%
(
message
,
to_
str
(
extended_error
))
else
:
else
:
self
.
message
=
'ERROR!
%
s'
%
message
self
.
message
=
'ERROR!
%
s'
%
message
...
...
lib/ansible/utils/unicode.py
View file @
0526b43b
...
@@ -251,3 +251,10 @@ def to_bytes(obj, encoding='utf-8', errors='replace', nonstring=None):
...
@@ -251,3 +251,10 @@ def to_bytes(obj, encoding='utf-8', errors='replace', nonstring=None):
# ensure that a filter will return unicode values.
# ensure that a filter will return unicode values.
def
unicode_wrap
(
func
,
*
args
,
**
kwargs
):
def
unicode_wrap
(
func
,
*
args
,
**
kwargs
):
return
to_unicode
(
func
(
*
args
,
**
kwargs
),
nonstring
=
'passthru'
)
return
to_unicode
(
func
(
*
args
,
**
kwargs
),
nonstring
=
'passthru'
)
# Alias for converting to native strings.
if
PY3
:
to_str
=
to_unicode
else
:
to_str
=
to_bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment