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
48366416
Commit
48366416
authored
9 years ago
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ansible_python_interpreter value for remote checksums
Fixes #11968 Fixes #11969
parent
7a518365
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
13 deletions
+12
-13
lib/ansible/plugins/action/__init__.py
+3
-4
lib/ansible/plugins/action/assemble.py
+1
-1
lib/ansible/plugins/action/copy.py
+2
-2
lib/ansible/plugins/action/fetch.py
+1
-1
lib/ansible/plugins/action/template.py
+4
-4
lib/ansible/plugins/action/unarchive.py
+1
-1
No files found.
lib/ansible/plugins/action/__init__.py
View file @
48366416
...
@@ -250,14 +250,13 @@ class ActionBase:
...
@@ -250,14 +250,13 @@ class ActionBase:
self
.
_display
.
debug
(
"done with chmod call"
)
self
.
_display
.
debug
(
"done with chmod call"
)
return
res
return
res
def
_remote_checksum
(
self
,
tmp
,
path
):
def
_remote_checksum
(
self
,
tmp
,
path
,
all_vars
):
'''
'''
Takes a remote checksum and returns 1 if no file
Takes a remote checksum and returns 1 if no file
'''
'''
# FIXME: figure out how this will work, probably pulled from the variable manager data
python_interp
=
all_vars
.
get
(
'ansible_python_interpreter'
,
'python'
)
#python_interp = inject['hostvars'][inject['inventory_hostname']].get('ansible_python_interpreter', 'python')
python_interp
=
'python'
cmd
=
self
.
_connection
.
_shell
.
checksum
(
path
,
python_interp
)
cmd
=
self
.
_connection
.
_shell
.
checksum
(
path
,
python_interp
)
self
.
_display
.
debug
(
"calling _low_level_execute_command to get the remote checksum"
)
self
.
_display
.
debug
(
"calling _low_level_execute_command to get the remote checksum"
)
data
=
self
.
_low_level_execute_command
(
cmd
,
tmp
,
sudoable
=
True
)
data
=
self
.
_low_level_execute_command
(
cmd
,
tmp
,
sudoable
=
True
)
...
...
This diff is collapsed.
Click to expand it.
lib/ansible/plugins/action/assemble.py
View file @
48366416
...
@@ -108,7 +108,7 @@ class ActionModule(ActionBase):
...
@@ -108,7 +108,7 @@ class ActionModule(ActionBase):
path_checksum
=
checksum_s
(
path
)
path_checksum
=
checksum_s
(
path
)
dest
=
self
.
_remote_expand_user
(
dest
,
tmp
)
dest
=
self
.
_remote_expand_user
(
dest
,
tmp
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
,
all_vars
=
task_vars
)
if
path_checksum
!=
remote_checksum
:
if
path_checksum
!=
remote_checksum
:
resultant
=
file
(
path
)
.
read
()
resultant
=
file
(
path
)
.
read
()
...
...
This diff is collapsed.
Click to expand it.
lib/ansible/plugins/action/copy.py
View file @
48366416
...
@@ -145,7 +145,7 @@ class ActionModule(ActionBase):
...
@@ -145,7 +145,7 @@ class ActionModule(ActionBase):
dest_file
=
self
.
_connection
.
_shell
.
join_path
(
dest
)
dest_file
=
self
.
_connection
.
_shell
.
join_path
(
dest
)
# Attempt to get the remote checksum
# Attempt to get the remote checksum
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest_file
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest_file
,
all_vars
=
task_vars
)
if
remote_checksum
==
'3'
:
if
remote_checksum
==
'3'
:
# The remote_checksum was executed on a directory.
# The remote_checksum was executed on a directory.
...
@@ -156,7 +156,7 @@ class ActionModule(ActionBase):
...
@@ -156,7 +156,7 @@ class ActionModule(ActionBase):
else
:
else
:
# Append the relative source location to the destination and retry remote_checksum
# Append the relative source location to the destination and retry remote_checksum
dest_file
=
self
.
_connection
.
_shell
.
join_path
(
dest
,
source_rel
)
dest_file
=
self
.
_connection
.
_shell
.
join_path
(
dest
,
source_rel
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest_file
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest_file
,
all_vars
=
task_vars
)
if
remote_checksum
!=
'1'
and
not
force
:
if
remote_checksum
!=
'1'
and
not
force
:
# remote_file does not exist so continue to next iteration.
# remote_file does not exist so continue to next iteration.
...
...
This diff is collapsed.
Click to expand it.
lib/ansible/plugins/action/fetch.py
View file @
48366416
...
@@ -55,7 +55,7 @@ class ActionModule(ActionBase):
...
@@ -55,7 +55,7 @@ class ActionModule(ActionBase):
source
=
self
.
_remote_expand_user
(
source
,
tmp
)
source
=
self
.
_remote_expand_user
(
source
,
tmp
)
# calculate checksum for the remote file
# calculate checksum for the remote file
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
source
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
source
,
all_vars
=
task_vars
)
# use slurp if sudo and permissions are lacking
# use slurp if sudo and permissions are lacking
remote_data
=
None
remote_data
=
None
...
...
This diff is collapsed.
Click to expand it.
lib/ansible/plugins/action/template.py
View file @
48366416
...
@@ -31,8 +31,8 @@ class ActionModule(ActionBase):
...
@@ -31,8 +31,8 @@ class ActionModule(ActionBase):
TRANSFERS_FILES
=
True
TRANSFERS_FILES
=
True
def
get_checksum
(
self
,
tmp
,
dest
,
try_directory
=
False
,
source
=
None
):
def
get_checksum
(
self
,
tmp
,
dest
,
all_vars
,
try_directory
=
False
,
source
=
None
):
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
,
all_vars
=
all_vars
)
if
remote_checksum
in
(
'0'
,
'2'
,
'3'
,
'4'
):
if
remote_checksum
in
(
'0'
,
'2'
,
'3'
,
'4'
):
# Note: 1 means the file is not present which is fine; template
# Note: 1 means the file is not present which is fine; template
...
@@ -40,7 +40,7 @@ class ActionModule(ActionBase):
...
@@ -40,7 +40,7 @@ class ActionModule(ActionBase):
if
try_directory
and
remote_checksum
==
'3'
and
source
:
if
try_directory
and
remote_checksum
==
'3'
and
source
:
base
=
os
.
path
.
basename
(
source
)
base
=
os
.
path
.
basename
(
source
)
dest
=
os
.
path
.
join
(
dest
,
base
)
dest
=
os
.
path
.
join
(
dest
,
base
)
remote_checksum
=
self
.
get_checksum
(
tmp
,
dest
,
try_directory
=
False
)
remote_checksum
=
self
.
get_checksum
(
tmp
,
dest
,
all_vars
=
all_vars
,
try_directory
=
False
)
if
remote_checksum
not
in
(
'0'
,
'2'
,
'3'
,
'4'
):
if
remote_checksum
not
in
(
'0'
,
'2'
,
'3'
,
'4'
):
return
remote_checksum
return
remote_checksum
...
@@ -124,7 +124,7 @@ class ActionModule(ActionBase):
...
@@ -124,7 +124,7 @@ class ActionModule(ActionBase):
return
dict
(
failed
=
True
,
msg
=
type
(
e
)
.
__name__
+
": "
+
str
(
e
))
return
dict
(
failed
=
True
,
msg
=
type
(
e
)
.
__name__
+
": "
+
str
(
e
))
local_checksum
=
checksum_s
(
resultant
)
local_checksum
=
checksum_s
(
resultant
)
remote_checksum
=
self
.
get_checksum
(
tmp
,
dest
,
not
directory_prepended
,
source
=
source
)
remote_checksum
=
self
.
get_checksum
(
tmp
,
dest
,
task_vars
,
not
directory_prepended
,
source
=
source
)
if
isinstance
(
remote_checksum
,
dict
):
if
isinstance
(
remote_checksum
,
dict
):
# Error from remote_checksum is a dict. Valid return is a str
# Error from remote_checksum is a dict. Valid return is a str
return
remote_checksum
return
remote_checksum
...
...
This diff is collapsed.
Click to expand it.
lib/ansible/plugins/action/unarchive.py
View file @
48366416
...
@@ -66,7 +66,7 @@ class ActionModule(ActionBase):
...
@@ -66,7 +66,7 @@ class ActionModule(ActionBase):
else
:
else
:
source
=
self
.
_loader
.
path_dwim
(
source
)
source
=
self
.
_loader
.
path_dwim
(
source
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
)
remote_checksum
=
self
.
_remote_checksum
(
tmp
,
dest
,
all_vars
=
task_vars
)
if
remote_checksum
!=
'3'
:
if
remote_checksum
!=
'3'
:
return
dict
(
failed
=
True
,
msg
=
"dest '
%
s' must be an existing dir"
%
dest
)
return
dict
(
failed
=
True
,
msg
=
"dest '
%
s' must be an existing dir"
%
dest
)
elif
remote_checksum
==
'4'
:
elif
remote_checksum
==
'4'
:
...
...
This diff is collapsed.
Click to expand it.
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