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
dfc70a98
Commit
dfc70a98
authored
Jun 15, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #477 from phred/md5sum-on-bsd
md5sum on bsd
parents
0fb59f0b
eda543f4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
10 deletions
+7
-10
lib/ansible/runner/__init__.py
+3
-3
library/copy
+2
-2
library/file
+0
-3
library/setup
+2
-2
No files found.
lib/ansible/runner/__init__.py
View file @
dfc70a98
...
@@ -476,8 +476,8 @@ class Runner(object):
...
@@ -476,8 +476,8 @@ class Runner(object):
# compare old and new md5 for support of change hooks
# compare old and new md5 for support of change hooks
local_md5
=
None
local_md5
=
None
if
os
.
path
.
exists
(
dest
):
if
os
.
path
.
exists
(
dest
):
local_md5
=
os
.
popen
(
"
md5sum
%
s"
%
dest
)
.
read
()
.
split
()[
0
]
local_md5
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
dest
}
)
.
read
()
.
split
()[
0
]
remote_md5
=
self
.
_low_level_exec_command
(
conn
,
"
md5sum
%
s"
%
source
,
tmp
,
True
)
.
split
()[
0
]
remote_md5
=
self
.
_low_level_exec_command
(
conn
,
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
source
}
,
tmp
,
True
)
.
split
()[
0
]
if
remote_md5
!=
local_md5
:
if
remote_md5
!=
local_md5
:
# create the containing directories, if needed
# create the containing directories, if needed
...
@@ -486,7 +486,7 @@ class Runner(object):
...
@@ -486,7 +486,7 @@ class Runner(object):
# fetch the file and check for changes
# fetch the file and check for changes
conn
.
fetch_file
(
source
,
dest
)
conn
.
fetch_file
(
source
,
dest
)
new_md5
=
os
.
popen
(
"
md5sum
%
s"
%
dest
)
.
read
()
.
split
()[
0
]
new_md5
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
dest
}
)
.
read
()
.
split
()[
0
]
if
new_md5
!=
remote_md5
:
if
new_md5
!=
remote_md5
:
result
=
dict
(
failed
=
True
,
msg
=
"md5 mismatch"
,
md5sum
=
new_md5
)
result
=
dict
(
failed
=
True
,
msg
=
"md5 mismatch"
,
md5sum
=
new_md5
)
return
ReturnData
(
host
=
conn
.
host
,
result
=
result
)
return
ReturnData
(
host
=
conn
.
host
,
result
=
result
)
...
...
library/copy
View file @
dfc70a98
...
@@ -60,9 +60,9 @@ if not os.path.exists(src):
...
@@ -60,9 +60,9 @@ if not os.path.exists(src):
md5sum
=
None
md5sum
=
None
changed
=
False
changed
=
False
if
os
.
path
.
exists
(
dest
):
if
os
.
path
.
exists
(
dest
):
md5sum
=
os
.
popen
(
"
md5sum
%
s"
%
dest
)
.
read
()
.
split
()[
0
]
md5sum
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
dest
}
)
.
read
()
.
split
()[
0
]
md5sum2
=
os
.
popen
(
"
md5sum
%
s"
%
src
)
.
read
()
.
split
()[
0
]
md5sum2
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
src
}
)
.
read
()
.
split
()[
0
]
if
md5sum
!=
md5sum2
:
if
md5sum
!=
md5sum2
:
os
.
system
(
"cp
%
s
%
s"
%
(
src
,
dest
))
os
.
system
(
"cp
%
s
%
s"
%
(
src
,
dest
))
...
...
library/file
View file @
dfc70a98
...
@@ -180,9 +180,6 @@ changed = False
...
@@ -180,9 +180,6 @@ changed = False
# ===========================================
# ===========================================
# support functions
# support functions
def
md5sum
(
filename
):
return
os
.
popen
(
"/usr/bin/md5sum
%
s"
%
f
)
.
read
()
def
user_and_group
(
filename
):
def
user_and_group
(
filename
):
st
=
os
.
stat
(
filename
)
st
=
os
.
stat
(
filename
)
uid
=
st
.
st_uid
uid
=
st
.
st_uid
...
...
library/setup
View file @
dfc70a98
...
@@ -345,7 +345,7 @@ md5sum = None
...
@@ -345,7 +345,7 @@ md5sum = None
if
not
os
.
path
.
exists
(
ansible_file
):
if
not
os
.
path
.
exists
(
ansible_file
):
changed
=
True
changed
=
True
else
:
else
:
md5sum
=
os
.
popen
(
"
md5sum
%
s"
%
ansible_file
)
.
read
()
.
split
()[
0
]
md5sum
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
ansible_file
}
)
.
read
()
.
split
()[
0
]
# Get some basic facts in case facter or ohai are not installed
# Get some basic facts in case facter or ohai are not installed
for
(
k
,
v
)
in
ansible_facts
()
.
items
():
for
(
k
,
v
)
in
ansible_facts
()
.
items
():
...
@@ -394,7 +394,7 @@ reformat = json.dumps(setup_options, sort_keys=True, indent=4)
...
@@ -394,7 +394,7 @@ reformat = json.dumps(setup_options, sort_keys=True, indent=4)
f
.
write
(
reformat
)
f
.
write
(
reformat
)
f
.
close
()
f
.
close
()
md5sum2
=
os
.
popen
(
"
md5sum
%
s"
%
ansible_file
)
.
read
()
.
split
()[
0
]
md5sum2
=
os
.
popen
(
"
/usr/bin/md5sum
%(file)
s 2> /dev/null || /sbin/md5 -q
%(file)
s"
%
{
"file"
:
ansible_file
}
)
.
read
()
.
split
()[
0
]
if
md5sum
!=
md5sum2
:
if
md5sum
!=
md5sum2
:
changed
=
True
changed
=
True
...
...
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