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
b44ae0af
Commit
b44ae0af
authored
Feb 25, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applying indentation patch from skvidal
parent
a5039eec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
25 deletions
+25
-25
lib/ansible/playbook.py
+11
-11
lib/ansible/runner.py
+0
-0
library/command
+2
-2
library/copy
+4
-4
library/ohai
+2
-2
library/ping
+2
-2
library/template
+4
-4
No files found.
lib/ansible/playbook.py
View file @
b44ae0af
...
@@ -101,7 +101,7 @@ class PlayBook(object):
...
@@ -101,7 +101,7 @@ class PlayBook(object):
'''
'''
if
host_list
is
None
:
if
host_list
is
None
:
host_list
=
self
.
host_list
host_list
=
self
.
host_list
return
ansible
.
runner
.
Runner
(
return
ansible
.
runner
.
Runner
(
pattern
=
pattern
,
pattern
=
pattern
,
...
@@ -122,7 +122,7 @@ class PlayBook(object):
...
@@ -122,7 +122,7 @@ class PlayBook(object):
'''
'''
if
host_list
is
None
:
if
host_list
is
None
:
host_list
=
self
.
host_list
host_list
=
self
.
host_list
instructions
=
task
[
'do'
]
instructions
=
task
[
'do'
]
(
comment
,
module_details
)
=
instructions
(
comment
,
module_details
)
=
instructions
...
@@ -161,10 +161,10 @@ class PlayBook(object):
...
@@ -161,10 +161,10 @@ class PlayBook(object):
self
.
processed
[
host
]
=
1
self
.
processed
[
host
]
=
1
failed
=
False
failed
=
False
if
module_name
==
"command"
:
if
module_name
==
"command"
:
if
results
.
get
(
"rc"
,
0
)
!=
0
:
if
results
.
get
(
"rc"
,
0
)
!=
0
:
failed
=
True
failed
=
True
elif
results
.
get
(
"failed"
,
0
)
==
1
:
elif
results
.
get
(
"failed"
,
0
)
==
1
:
failed
=
True
failed
=
True
if
failed
:
if
failed
:
if
self
.
verbose
:
if
self
.
verbose
:
...
@@ -191,9 +191,9 @@ class PlayBook(object):
...
@@ -191,9 +191,9 @@ class PlayBook(object):
subtasks
=
task
.
get
(
'notify'
,
[])
subtasks
=
task
.
get
(
'notify'
,
[])
if
len
(
subtasks
)
>
0
:
if
len
(
subtasks
)
>
0
:
for
host
,
results
in
contacted
.
items
():
for
host
,
results
in
contacted
.
items
():
if
results
.
get
(
'changed'
,
False
):
if
results
.
get
(
'changed'
,
False
):
for
subtask
in
subtasks
:
for
subtask
in
subtasks
:
self
.
_flag_handler
(
handlers
,
subtask
,
host
)
self
.
_flag_handler
(
handlers
,
subtask
,
host
)
# TODO: if a host fails in any task, remove it from
# TODO: if a host fails in any task, remove it from
# the host list immediately
# the host list immediately
...
@@ -208,9 +208,9 @@ class PlayBook(object):
...
@@ -208,9 +208,9 @@ class PlayBook(object):
attribs
=
x
[
"do"
]
attribs
=
x
[
"do"
]
name
=
attribs
[
0
]
name
=
attribs
[
0
]
if
match_name
==
name
:
if
match_name
==
name
:
if
not
x
.
has_key
(
"run"
):
if
not
x
.
has_key
(
"run"
):
x
[
'run'
]
=
[]
x
[
'run'
]
=
[]
x
[
'run'
]
.
append
(
host
)
x
[
'run'
]
.
append
(
host
)
def
_run_pattern
(
self
,
pg
):
def
_run_pattern
(
self
,
pg
):
'''
'''
...
...
lib/ansible/runner.py
View file @
b44ae0af
This diff is collapsed.
Click to expand it.
library/command
View file @
b44ae0af
#!/usr/bin/python
#!/usr/bin/python
try
:
try
:
import
json
import
json
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
import
subprocess
import
subprocess
import
sys
import
sys
...
...
library/copy
View file @
b44ae0af
...
@@ -4,9 +4,9 @@ import sys
...
@@ -4,9 +4,9 @@ import sys
import
os
import
os
try
:
try
:
import
json
import
json
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
source
=
sys
.
argv
[
1
]
source
=
sys
.
argv
[
1
]
dest
=
sys
.
argv
[
2
]
dest
=
sys
.
argv
[
2
]
...
@@ -22,14 +22,14 @@ if not os.path.exists(source):
...
@@ -22,14 +22,14 @@ if not os.path.exists(source):
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
()
md5sum
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
os
.
system
(
"cp
%
s
%
s"
%
(
source
,
dest
))
os
.
system
(
"cp
%
s
%
s"
%
(
source
,
dest
))
md5sum2
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
md5sum2
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
if
md5sum
!=
md5sum2
:
if
md5sum
!=
md5sum2
:
changed
=
True
changed
=
True
# mission accomplished
# mission accomplished
print
json
.
dumps
({
print
json
.
dumps
({
...
...
library/ohai
View file @
b44ae0af
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
# requires 'ohai' to be installed
# requires 'ohai' to be installed
try
:
try
:
import
json
import
json
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
import
subprocess
import
subprocess
...
...
library/ping
View file @
b44ae0af
#!/usr/bin/python
#!/usr/bin/python
try
:
try
:
import
json
import
json
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
print
json
.
dumps
(
1
)
print
json
.
dumps
(
1
)
library/template
View file @
b44ae0af
...
@@ -4,9 +4,9 @@ import sys
...
@@ -4,9 +4,9 @@ import sys
import
os
import
os
import
jinja2
import
jinja2
try
:
try
:
import
json
import
json
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
source
=
sys
.
argv
[
1
]
source
=
sys
.
argv
[
1
]
dest
=
sys
.
argv
[
2
]
dest
=
sys
.
argv
[
2
]
...
@@ -45,7 +45,7 @@ source = file(source).read()
...
@@ -45,7 +45,7 @@ source = file(source).read()
changed
=
False
changed
=
False
md5sum
=
None
md5sum
=
None
if
os
.
path
.
exists
(
dest
):
if
os
.
path
.
exists
(
dest
):
md5sum
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
md5sum
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
# call Jinja2 here and save the new template file
# call Jinja2 here and save the new template file
template
=
jinja2
.
Template
(
source
)
template
=
jinja2
.
Template
(
source
)
...
@@ -61,7 +61,7 @@ f.close()
...
@@ -61,7 +61,7 @@ f.close()
md5sum2
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
md5sum2
=
os
.
popen
(
"md5sum
%
s"
%
dest
)
.
read
()
if
md5sum
!=
md5sum2
:
if
md5sum
!=
md5sum2
:
changed
=
True
changed
=
True
# mission accomplished
# mission accomplished
print
json
.
dumps
({
print
json
.
dumps
({
...
...
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