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
a6de4b86
Commit
a6de4b86
authored
Sep 04, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12244 from mgedmin/py3k
Python 3: use six.text_type instead of unicode
parents
1840906f
0eb0b567
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
16 deletions
+22
-16
contrib/inventory/apache-libcloud.py
+4
-4
contrib/inventory/vmware.py
+3
-1
lib/ansible/executor/process/result.py
+2
-2
lib/ansible/parsing/__init__.py
+2
-1
lib/ansible/playbook/base.py
+2
-2
lib/ansible/playbook/conditional.py
+2
-1
lib/ansible/plugins/shell/sh.py
+3
-1
lib/ansible/plugins/strategies/__init__.py
+2
-2
lib/ansible/plugins/strategies/linear.py
+2
-2
No files found.
contrib/inventory/apache-libcloud.py
View file @
a6de4b86
...
...
@@ -37,7 +37,7 @@ import re
from
time
import
time
import
ConfigParser
from
six
import
iteritems
from
six
import
iteritems
,
string_types
from
libcloud.compute.types
import
Provider
from
libcloud.compute.providers
import
get_driver
import
libcloud.security
as
sec
...
...
@@ -260,11 +260,11 @@ class LibcloudInventory(object):
key
=
self
.
to_safe
(
'ec2_'
+
key
)
# Handle complex types
if
type
(
value
)
in
[
int
,
bool
]
:
if
isinstance
(
value
,
(
int
,
bool
))
:
instance_vars
[
key
]
=
value
elif
type
(
value
)
in
[
str
,
unicode
]
:
elif
isinstance
(
value
,
string_types
)
:
instance_vars
[
key
]
=
value
.
strip
()
elif
type
(
value
)
==
type
(
None
)
:
elif
value
is
None
:
instance_vars
[
key
]
=
''
elif
key
==
'ec2_region'
:
instance_vars
[
key
]
=
value
.
name
...
...
contrib/inventory/vmware.py
View file @
a6de4b86
...
...
@@ -39,6 +39,8 @@ import sys
import
time
import
ConfigParser
from
six
import
text_type
# Disable logging message trigged by pSphere/suds.
try
:
from
logging
import
NullHandler
...
...
@@ -149,7 +151,7 @@ class VMwareInventory(object):
seen
=
seen
or
set
()
if
isinstance
(
obj
,
ManagedObject
):
try
:
obj_unicode
=
unicod
e
(
getattr
(
obj
,
'name'
))
obj_unicode
=
text_typ
e
(
getattr
(
obj
,
'name'
))
except
AttributeError
:
obj_unicode
=
()
if
obj
in
seen
:
...
...
lib/ansible/executor/process/result.py
View file @
a6de4b86
...
...
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__
=
type
from
six.moves
import
queue
from
six
import
iteritems
from
six
import
iteritems
,
text_type
import
multiprocessing
import
os
...
...
@@ -62,7 +62,7 @@ class ResultProcess(multiprocessing.Process):
super
(
ResultProcess
,
self
)
.
__init__
()
def
_send_result
(
self
,
result
):
debug
(
u"sending result:
%
s"
%
([
unicod
e
(
x
)
for
x
in
result
],))
debug
(
u"sending result:
%
s"
%
([
text_typ
e
(
x
)
for
x
in
result
],))
self
.
_final_q
.
put
(
result
,
block
=
False
)
debug
(
"done sending result"
)
...
...
lib/ansible/parsing/__init__.py
View file @
a6de4b86
...
...
@@ -24,6 +24,7 @@ import json
import
os
from
yaml
import
load
,
YAMLError
from
six
import
text_type
from
ansible.errors
import
AnsibleParserError
from
ansible.errors.yaml_strings
import
YAML_SYNTAX_ERROR
...
...
@@ -80,7 +81,7 @@ class DataLoader():
# they are unable to cope with our subclass.
# Unwrap and re-wrap the unicode so we can keep track of line
# numbers
new_data
=
unicod
e
(
data
)
new_data
=
text_typ
e
(
data
)
else
:
new_data
=
data
try
:
...
...
lib/ansible/playbook/base.py
View file @
a6de4b86
...
...
@@ -27,7 +27,7 @@ from functools import partial
from
inspect
import
getmembers
from
io
import
FileIO
from
six
import
iteritems
,
string_types
from
six
import
iteritems
,
string_types
,
text_type
from
jinja2.exceptions
import
UndefinedError
...
...
@@ -291,7 +291,7 @@ class Base:
# and make sure the attribute is of the type it should be
if
value
is
not
None
:
if
attribute
.
isa
==
'string'
:
value
=
unicod
e
(
value
)
value
=
text_typ
e
(
value
)
elif
attribute
.
isa
==
'int'
:
value
=
int
(
value
)
elif
attribute
.
isa
==
'float'
:
...
...
lib/ansible/playbook/conditional.py
View file @
a6de4b86
...
...
@@ -20,6 +20,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__
=
type
from
jinja2.exceptions
import
UndefinedError
from
six
import
text_type
from
ansible.errors
import
*
from
ansible.playbook.attribute
import
FieldAttribute
...
...
@@ -82,7 +83,7 @@ class Conditional:
if
conditional
is
None
or
conditional
==
''
:
return
True
if
conditional
in
all_vars
and
'-'
not
in
unicod
e
(
all_vars
[
conditional
]):
if
conditional
in
all_vars
and
'-'
not
in
text_typ
e
(
all_vars
[
conditional
]):
conditional
=
all_vars
[
conditional
]
# make sure the templar is using the variables specifed to this method
...
...
lib/ansible/plugins/shell/sh.py
View file @
a6de4b86
...
...
@@ -24,6 +24,8 @@ import ansible.constants as C
import
time
import
random
from
six
import
text_type
_USER_HOME_PATH_RE
=
re
.
compile
(
r'^~[_.A-Za-z0-9][-_.A-Za-z0-9]*$'
)
class
ShellModule
(
object
):
...
...
@@ -40,7 +42,7 @@ class ShellModule(object):
LC_MESSAGES
=
C
.
DEFAULT_MODULE_LANG
,
)
env
.
update
(
kwargs
)
return
' '
.
join
([
'
%
s=
%
s'
%
(
k
,
pipes
.
quote
(
unicod
e
(
v
)))
for
k
,
v
in
env
.
items
()])
return
' '
.
join
([
'
%
s=
%
s'
%
(
k
,
pipes
.
quote
(
text_typ
e
(
v
)))
for
k
,
v
in
env
.
items
()])
def
join_path
(
self
,
*
args
):
return
os
.
path
.
join
(
*
args
)
...
...
lib/ansible/plugins/strategies/__init__.py
View file @
a6de4b86
...
...
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__
=
type
from
six.moves
import
queue
as
Queue
from
six
import
iteritems
from
six
import
iteritems
,
text_type
import
time
...
...
@@ -168,7 +168,7 @@ class StrategyBase:
while
not
self
.
_final_q
.
empty
()
and
not
self
.
_tqm
.
_terminated
:
try
:
result
=
self
.
_final_q
.
get
(
block
=
False
)
self
.
_display
.
debug
(
"got result from result worker:
%
s"
%
([
unicod
e
(
x
)
for
x
in
result
],))
self
.
_display
.
debug
(
"got result from result worker:
%
s"
%
([
text_typ
e
(
x
)
for
x
in
result
],))
# all host status messages contain 2 entries: (msg, task_result)
if
result
[
0
]
in
(
'host_task_ok'
,
'host_task_failed'
,
'host_task_skipped'
,
'host_unreachable'
):
...
...
lib/ansible/plugins/strategies/linear.py
View file @
a6de4b86
...
...
@@ -19,7 +19,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
from
six
import
iteritems
from
six
import
iteritems
,
text_type
from
ansible.errors
import
AnsibleError
from
ansible.executor.play_iterator
import
PlayIterator
...
...
@@ -221,7 +221,7 @@ class StrategyModule(StrategyBase):
saved_name
=
task
.
name
display
.
debug
(
"done copying, going to template now"
)
try
:
task
.
name
=
unicod
e
(
templar
.
template
(
task
.
name
,
fail_on_undefined
=
False
))
task
.
name
=
text_typ
e
(
templar
.
template
(
task
.
name
,
fail_on_undefined
=
False
))
display
.
debug
(
"done templating"
)
except
:
# just ignore any errors during task name templating,
...
...
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