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
1d8bb177
Commit
1d8bb177
authored
Jul 15, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc code cleanup
parent
5a63a48e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
68 deletions
+34
-68
lib/ansible/inventory/__init__.py
+1
-2
lib/ansible/playbook/__init__.py
+3
-2
lib/ansible/runner/__init__.py
+30
-64
No files found.
lib/ansible/inventory/__init__.py
View file @
1d8bb177
...
@@ -94,7 +94,7 @@ class Inventory(object):
...
@@ -94,7 +94,7 @@ class Inventory(object):
for
group
in
groups
:
for
group
in
groups
:
for
host
in
group
.
get_hosts
():
for
host
in
group
.
get_hosts
():
if
group
.
name
==
pat
or
pat
==
'all'
or
self
.
_match
(
host
.
name
,
pat
):
if
group
.
name
==
pat
or
pat
==
'all'
or
self
.
_match
(
host
.
name
,
pat
):
#must test explicitly for None because [] means no hosts allowed
#
must test explicitly for None because [] means no hosts allowed
if
self
.
_restriction
==
None
or
host
.
name
in
self
.
_restriction
:
if
self
.
_restriction
==
None
or
host
.
name
in
self
.
_restriction
:
if
inverted
:
if
inverted
:
if
host
.
name
in
hosts
:
if
host
.
name
in
hosts
:
...
@@ -128,7 +128,6 @@ class Inventory(object):
...
@@ -128,7 +128,6 @@ class Inventory(object):
def
get_variables
(
self
,
hostname
):
def
get_variables
(
self
,
hostname
):
if
self
.
_is_script
:
if
self
.
_is_script
:
# TODO: move this to inventory_script.py
host
=
self
.
get_host
(
hostname
)
host
=
self
.
get_host
(
hostname
)
cmd
=
subprocess
.
Popen
(
cmd
=
subprocess
.
Popen
(
[
self
.
host_list
,
"--host"
,
hostname
],
[
self
.
host_list
,
"--host"
,
hostname
],
...
...
lib/ansible/playbook/__init__.py
View file @
1d8bb177
...
@@ -23,6 +23,7 @@ import ansible.constants as C
...
@@ -23,6 +23,7 @@ import ansible.constants as C
from
ansible
import
utils
from
ansible
import
utils
from
ansible
import
errors
from
ansible
import
errors
import
os
import
os
import
collections
from
play
import
Play
from
play
import
Play
#############################################
#############################################
...
@@ -81,7 +82,7 @@ class PlayBook(object):
...
@@ -81,7 +82,7 @@ class PlayBook(object):
sudo: if not specified per play, requests all plays use sudo mode
sudo: if not specified per play, requests all plays use sudo mode
"""
"""
self
.
SETUP_CACHE
=
{}
self
.
SETUP_CACHE
=
collections
.
defaultdict
(
dict
)
if
playbook
is
None
or
callbacks
is
None
or
runner_callbacks
is
None
or
stats
is
None
:
if
playbook
is
None
or
callbacks
is
None
or
runner_callbacks
is
None
or
stats
is
None
:
raise
Exception
(
'missing required arguments'
)
raise
Exception
(
'missing required arguments'
)
...
@@ -157,7 +158,7 @@ class PlayBook(object):
...
@@ -157,7 +158,7 @@ class PlayBook(object):
# loop through all patterns and run them
# loop through all patterns and run them
self
.
callbacks
.
on_start
()
self
.
callbacks
.
on_start
()
for
play_ds
in
self
.
playbook
:
for
play_ds
in
self
.
playbook
:
self
.
SETUP_CACHE
=
{}
self
.
SETUP_CACHE
=
collections
.
defaultdict
(
dict
)
self
.
_run_play
(
Play
(
self
,
play_ds
))
self
.
_run_play
(
Play
(
self
,
play_ds
))
# summarize the results
# summarize the results
...
...
lib/ansible/runner/__init__.py
View file @
1d8bb177
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