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
c6f3a0a4
Commit
c6f3a0a4
authored
May 01, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7243 from jimi-c/issue_7060_lang_c
Modify the way we set the localization environment
parents
ae7503d6
54b1f820
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
15 deletions
+14
-15
lib/ansible/module_common.py
+0
-4
lib/ansible/module_utils/basic.py
+0
-3
lib/ansible/runner/__init__.py
+14
-8
No files found.
lib/ansible/module_common.py
View file @
c6f3a0a4
...
...
@@ -28,7 +28,6 @@ from ansible import constants as C
REPLACER
=
"#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
REPLACER_ARGS
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_ARGS>>
\"
"
REPLACER_LANG
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_LANG>>
\"
"
REPLACER_COMPLEX
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>
\"
"
class
ModuleReplacer
(
object
):
...
...
@@ -140,12 +139,10 @@ class ModuleReplacer(object):
encoded_args
=
repr
(
module_args
.
encode
(
'utf-8'
))
except
UnicodeDecodeError
:
encoded_args
=
repr
(
module_args
)
encoded_lang
=
repr
(
C
.
DEFAULT_MODULE_LANG
)
encoded_complex
=
repr
(
complex_args_json
)
# these strings should be part of the 'basic' snippet which is required to be included
module_data
=
module_data
.
replace
(
REPLACER_ARGS
,
encoded_args
)
module_data
=
module_data
.
replace
(
REPLACER_LANG
,
encoded_lang
)
module_data
=
module_data
.
replace
(
REPLACER_COMPLEX
,
encoded_complex
)
if
module_style
==
'new'
:
...
...
@@ -154,7 +151,6 @@ class ModuleReplacer(object):
facility
=
inject
[
'ansible_syslog_facility'
]
module_data
=
module_data
.
replace
(
'syslog.LOG_USER'
,
"syslog.
%
s"
%
facility
)
lines
=
module_data
.
split
(
"
\n
"
)
shebang
=
None
if
lines
[
0
]
.
startswith
(
"#!"
):
...
...
lib/ansible/module_utils/basic.py
View file @
c6f3a0a4
...
...
@@ -30,7 +30,6 @@
# == BEGIN DYNAMICALLY INSERTED CODE ==
MODULE_ARGS
=
"<<INCLUDE_ANSIBLE_MODULE_ARGS>>"
MODULE_LANG
=
"<<INCLUDE_ANSIBLE_MODULE_LANG>>"
MODULE_COMPLEX_ARGS
=
"<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>"
BOOLEANS_TRUE
=
[
'yes'
,
'on'
,
'1'
,
'true'
,
1
]
...
...
@@ -191,8 +190,6 @@ class AnsibleModule(object):
if
k
not
in
self
.
argument_spec
:
self
.
argument_spec
[
k
]
=
v
os
.
environ
[
'LANG'
]
=
MODULE_LANG
os
.
environ
[
'LC_CTYPE'
]
=
MODULE_LANG
(
self
.
params
,
self
.
args
)
=
self
.
_load_params
()
self
.
_legal_inputs
=
[
'CHECKMODE'
,
'NO_LOG'
]
...
...
lib/ansible/runner/__init__.py
View file @
c6f3a0a4
...
...
@@ -287,15 +287,21 @@ class Runner(object):
def
_compute_environment_string
(
self
,
inject
=
None
):
''' what environment variables to use when running the command? '''
if
not
self
.
environment
:
return
""
enviro
=
template
.
template
(
self
.
basedir
,
self
.
environment
,
inject
,
convert_bare
=
True
)
enviro
=
utils
.
safe_eval
(
enviro
)
if
type
(
enviro
)
!=
dict
:
raise
errors
.
AnsibleError
(
"environment must be a dictionary, received
%
s"
%
enviro
)
default_environment
=
collections
.
OrderedDict
([
(
'LANG'
,
C
.
DEFAULT_MODULE_LANG
),
(
'LC_CTYPE'
,
C
.
DEFAULT_MODULE_LANG
),
])
if
self
.
environment
:
enviro
=
template
.
template
(
self
.
basedir
,
self
.
environment
,
inject
,
convert_bare
=
True
)
enviro
=
utils
.
safe_eval
(
enviro
)
if
type
(
enviro
)
!=
dict
:
raise
errors
.
AnsibleError
(
"environment must be a dictionary, received
%
s"
%
enviro
)
default_environment
.
update
(
enviro
)
result
=
""
for
(
k
,
v
)
in
enviro
.
iteritems
():
result
=
"
%
s
=
%
s
%
s"
%
(
k
,
pipes
.
quote
(
unicode
(
v
)),
result
)
for
(
k
,
v
)
in
default_environment
.
iteritems
():
result
=
"
%
s
%
s=
%
s"
%
(
result
,
k
,
pipes
.
quote
(
unicode
(
v
))
)
return
result
# *****************************************************
...
...
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