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
30c50020
Commit
30c50020
authored
Nov 10, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better way to get the python_interpreter inventory variable
parent
d32e1adb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
11 deletions
+9
-11
lib/ansible/runner/__init__.py
+2
-4
lib/ansible/runner/action_plugins/assemble.py
+1
-1
lib/ansible/runner/action_plugins/copy.py
+2
-2
lib/ansible/runner/action_plugins/fetch.py
+2
-2
lib/ansible/runner/action_plugins/template.py
+1
-1
lib/ansible/runner/action_plugins/unarchive.py
+1
-1
No files found.
lib/ansible/runner/__init__.py
View file @
30c50020
...
...
@@ -1159,11 +1159,9 @@ class Runner(object):
# *****************************************************
def
_remote_checksum
(
self
,
conn
,
tmp
,
path
):
def
_remote_checksum
(
self
,
conn
,
tmp
,
path
,
inject
):
''' takes a remote checksum and returns 1 if no file '''
inject
=
self
.
get_inject_vars
(
conn
.
host
)
hostvars
=
HostVars
(
inject
[
'combined_cache'
],
self
.
inventory
,
vault_password
=
self
.
vault_pass
)
python_interp
=
hostvars
[
conn
.
host
]
.
get
(
'ansible_python_interpreter'
,
'python'
)
python_interp
=
inject
[
'hostvars'
][
inject
[
'inventory_hostname'
]]
.
get
(
'ansible_python_interpreter'
,
'python'
)
cmd
=
conn
.
shell
.
checksum
(
path
,
python_interp
)
data
=
self
.
_low_level_exec_command
(
conn
,
cmd
,
tmp
,
sudoable
=
True
)
data2
=
utils
.
last_non_blank_line
(
data
[
'stdout'
])
...
...
lib/ansible/runner/action_plugins/assemble.py
View file @
30c50020
...
...
@@ -109,7 +109,7 @@ class ActionModule(object):
path
=
self
.
_assemble_from_fragments
(
src
,
delimiter
,
_re
)
path_checksum
=
utils
.
checksum_s
(
path
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
,
inject
)
if
path_checksum
!=
remote_checksum
:
resultant
=
file
(
path
)
.
read
()
...
...
lib/ansible/runner/action_plugins/copy.py
View file @
30c50020
...
...
@@ -175,7 +175,7 @@ class ActionModule(object):
dest_file
=
conn
.
shell
.
join_path
(
dest
)
# Attempt to get the remote checksum
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp_path
,
dest_file
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp_path
,
dest_file
,
inject
)
if
remote_checksum
==
'3'
:
# The remote_checksum was executed on a directory.
...
...
@@ -187,7 +187,7 @@ class ActionModule(object):
else
:
# Append the relative source location to the destination and retry remote_checksum
dest_file
=
conn
.
shell
.
join_path
(
dest
,
source_rel
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp_path
,
dest_file
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp_path
,
dest_file
,
inject
)
if
remote_checksum
!=
'1'
and
not
force
:
# remote_file does not exist so continue to next iteration.
...
...
lib/ansible/runner/action_plugins/fetch.py
View file @
30c50020
...
...
@@ -73,7 +73,7 @@ class ActionModule(object):
source
=
conn
.
shell
.
join_path
(
source
)
# calculate checksum for the remote file
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
source
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
source
,
inject
)
# use slurp if sudo and permissions are lacking
remote_data
=
None
...
...
@@ -116,7 +116,7 @@ class ActionModule(object):
# these don't fail because you may want to transfer a log file that possibly MAY exist
# but keep going to fetch other log files
if
remote_checksum
==
'0'
:
result
=
dict
(
msg
=
"unable to calculate the
md5
sum of the remote file"
,
file
=
source
,
changed
=
False
)
result
=
dict
(
msg
=
"unable to calculate the
check
sum of the remote file"
,
file
=
source
,
changed
=
False
)
return
ReturnData
(
conn
=
conn
,
result
=
result
)
if
remote_checksum
==
'1'
:
if
fail_on_missing
:
...
...
lib/ansible/runner/action_plugins/template.py
View file @
30c50020
...
...
@@ -88,7 +88,7 @@ class ActionModule(object):
return
ReturnData
(
conn
=
conn
,
comm_ok
=
False
,
result
=
result
)
local_checksum
=
utils
.
checksum_s
(
resultant
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
,
inject
)
if
local_checksum
!=
remote_checksum
:
...
...
lib/ansible/runner/action_plugins/unarchive.py
View file @
30c50020
...
...
@@ -62,7 +62,7 @@ class ActionModule(object):
else
:
source
=
utils
.
path_dwim
(
self
.
runner
.
basedir
,
source
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
)
remote_checksum
=
self
.
runner
.
_remote_checksum
(
conn
,
tmp
,
dest
,
inject
)
if
remote_checksum
!=
'3'
:
result
=
dict
(
failed
=
True
,
msg
=
"dest '
%
s' must be an existing dir"
%
dest
)
return
ReturnData
(
conn
=
conn
,
result
=
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