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
154754ae
Commit
154754ae
authored
Aug 25, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli fixes #12016
parent
d2c948dd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
15 deletions
+17
-15
lib/ansible/cli/__init__.py
+5
-4
lib/ansible/cli/adhoc.py
+2
-1
lib/ansible/cli/doc.py
+1
-2
lib/ansible/cli/playbook.py
+1
-0
lib/ansible/cli/pull.py
+1
-0
lib/ansible/executor/playbook_executor.py
+0
-7
lib/ansible/executor/task_queue_manager.py
+7
-1
No files found.
lib/ansible/cli/__init__.py
View file @
154754ae
...
@@ -220,7 +220,7 @@ class CLI(object):
...
@@ -220,7 +220,7 @@ class CLI(object):
setattr
(
parser
.
values
,
option
.
dest
,
os
.
path
.
expanduser
(
value
))
setattr
(
parser
.
values
,
option
.
dest
,
os
.
path
.
expanduser
(
value
))
@staticmethod
@staticmethod
def
base_parser
(
usage
=
""
,
output_opts
=
False
,
runas_opts
=
False
,
meta_opts
=
False
,
runtask_opts
=
False
,
vault_opts
=
False
,
def
base_parser
(
usage
=
""
,
output_opts
=
False
,
runas_opts
=
False
,
meta_opts
=
False
,
runtask_opts
=
False
,
vault_opts
=
False
,
module_opts
=
False
,
async_opts
=
False
,
connect_opts
=
False
,
subset_opts
=
False
,
check_opts
=
False
,
inventory_opts
=
False
,
epilog
=
None
,
fork_opts
=
False
):
async_opts
=
False
,
connect_opts
=
False
,
subset_opts
=
False
,
check_opts
=
False
,
inventory_opts
=
False
,
epilog
=
None
,
fork_opts
=
False
):
''' create an options parser for most ansible scripts '''
''' create an options parser for most ansible scripts '''
...
@@ -241,10 +241,11 @@ class CLI(object):
...
@@ -241,10 +241,11 @@ class CLI(object):
parser
.
add_option
(
'-l'
,
'--limit'
,
default
=
C
.
DEFAULT_SUBSET
,
dest
=
'subset'
,
parser
.
add_option
(
'-l'
,
'--limit'
,
default
=
C
.
DEFAULT_SUBSET
,
dest
=
'subset'
,
help
=
'further limit selected hosts to an additional pattern'
)
help
=
'further limit selected hosts to an additional pattern'
)
if
runtask
_opts
:
if
module
_opts
:
parser
.
add_option
(
'-M'
,
'--module-path'
,
dest
=
'module_path'
,
parser
.
add_option
(
'-M'
,
'--module-path'
,
dest
=
'module_path'
,
default
=
None
,
help
=
"specify path(s) to module library (default=
%
s)"
%
C
.
DEFAULT_MODULE_PATH
,
default
=
None
,
help
=
"specify path(s) to module library (default=
%
s)"
%
C
.
DEFAULT_MODULE_PATH
,
action
=
"callback"
,
callback
=
CLI
.
expand_tilde
,
type
=
str
)
action
=
"callback"
,
callback
=
CLI
.
expand_tilde
,
type
=
str
)
if
runtask_opts
:
parser
.
add_option
(
'-e'
,
'--extra-vars'
,
dest
=
"extra_vars"
,
action
=
"append"
,
parser
.
add_option
(
'-e'
,
'--extra-vars'
,
dest
=
"extra_vars"
,
action
=
"append"
,
help
=
"set additional variables as key=value or YAML/JSON"
,
default
=
[])
help
=
"set additional variables as key=value or YAML/JSON"
,
default
=
[])
...
...
lib/ansible/cli/adhoc.py
View file @
154754ae
...
@@ -46,6 +46,7 @@ class AdHocCLI(CLI):
...
@@ -46,6 +46,7 @@ class AdHocCLI(CLI):
runtask_opts
=
True
,
runtask_opts
=
True
,
vault_opts
=
True
,
vault_opts
=
True
,
fork_opts
=
True
,
fork_opts
=
True
,
module_opts
=
True
,
)
)
# options unique to ansible ad-hoc
# options unique to ansible ad-hoc
...
@@ -87,7 +88,7 @@ class AdHocCLI(CLI):
...
@@ -87,7 +88,7 @@ class AdHocCLI(CLI):
self
.
options
.
ask_pass
=
False
self
.
options
.
ask_pass
=
False
sshpass
=
None
sshpass
=
None
becomepass
=
None
becomepass
=
None
vault_pass
=
None
vault_pass
=
None
self
.
normalize_become_options
()
self
.
normalize_become_options
()
...
...
lib/ansible/cli/doc.py
View file @
154754ae
...
@@ -46,10 +46,9 @@ class DocCLI(CLI):
...
@@ -46,10 +46,9 @@ class DocCLI(CLI):
self
.
parser
=
CLI
.
base_parser
(
self
.
parser
=
CLI
.
base_parser
(
usage
=
'usage:
%
prog [options] [module...]'
,
usage
=
'usage:
%
prog [options] [module...]'
,
epilog
=
'Show Ansible module documentation'
,
epilog
=
'Show Ansible module documentation'
,
module_opts
=
True
,
)
)
self
.
parser
.
add_option
(
"-M"
,
"--module-path"
,
action
=
"store"
,
dest
=
"module_path"
,
default
=
C
.
DEFAULT_MODULE_PATH
,
help
=
"Ansible modules/ directory"
)
self
.
parser
.
add_option
(
"-l"
,
"--list"
,
action
=
"store_true"
,
default
=
False
,
dest
=
'list_dir'
,
self
.
parser
.
add_option
(
"-l"
,
"--list"
,
action
=
"store_true"
,
default
=
False
,
dest
=
'list_dir'
,
help
=
'List available modules'
)
help
=
'List available modules'
)
self
.
parser
.
add_option
(
"-s"
,
"--snippet"
,
action
=
"store_true"
,
default
=
False
,
dest
=
'show_snippet'
,
self
.
parser
.
add_option
(
"-s"
,
"--snippet"
,
action
=
"store_true"
,
default
=
False
,
dest
=
'show_snippet'
,
...
...
lib/ansible/cli/playbook.py
View file @
154754ae
...
@@ -48,6 +48,7 @@ class PlaybookCLI(CLI):
...
@@ -48,6 +48,7 @@ class PlaybookCLI(CLI):
runtask_opts
=
True
,
runtask_opts
=
True
,
vault_opts
=
True
,
vault_opts
=
True
,
fork_opts
=
True
,
fork_opts
=
True
,
module_opts
=
True
,
)
)
# ansible playbook specific opts
# ansible playbook specific opts
...
...
lib/ansible/cli/pull.py
View file @
154754ae
...
@@ -53,6 +53,7 @@ class PullCLI(CLI):
...
@@ -53,6 +53,7 @@ class PullCLI(CLI):
runtask_opts
=
True
,
runtask_opts
=
True
,
subset_opts
=
True
,
subset_opts
=
True
,
inventory_opts
=
True
,
inventory_opts
=
True
,
module_opts
=
True
,
)
)
# options unique to pull
# options unique to pull
...
...
lib/ansible/executor/playbook_executor.py
View file @
154754ae
...
@@ -28,7 +28,6 @@ from ansible import constants as C
...
@@ -28,7 +28,6 @@ from ansible import constants as C
from
ansible.errors
import
*
from
ansible.errors
import
*
from
ansible.executor.task_queue_manager
import
TaskQueueManager
from
ansible.executor.task_queue_manager
import
TaskQueueManager
from
ansible.playbook
import
Playbook
from
ansible.playbook
import
Playbook
from
ansible.plugins
import
module_loader
from
ansible.template
import
Templar
from
ansible.template
import
Templar
from
ansible.utils.color
import
colorize
,
hostcolor
from
ansible.utils.color
import
colorize
,
hostcolor
...
@@ -52,12 +51,6 @@ class PlaybookExecutor:
...
@@ -52,12 +51,6 @@ class PlaybookExecutor:
self
.
_options
=
options
self
.
_options
=
options
self
.
passwords
=
passwords
self
.
passwords
=
passwords
# make sure the module path (if specified) is parsed and
# added to the module_loader object
if
options
.
module_path
is
not
None
:
for
path
in
options
.
module_path
.
split
(
os
.
pathsep
):
module_loader
.
add_directory
(
path
)
if
options
.
listhosts
or
options
.
listtasks
or
options
.
listtags
or
options
.
syntax
:
if
options
.
listhosts
or
options
.
listtasks
or
options
.
listtags
or
options
.
syntax
:
self
.
_tqm
=
None
self
.
_tqm
=
None
else
:
else
:
...
...
lib/ansible/executor/task_queue_manager.py
View file @
154754ae
...
@@ -31,7 +31,7 @@ from ansible.executor.process.worker import WorkerProcess
...
@@ -31,7 +31,7 @@ from ansible.executor.process.worker import WorkerProcess
from
ansible.executor.process.result
import
ResultProcess
from
ansible.executor.process.result
import
ResultProcess
from
ansible.executor.stats
import
AggregateStats
from
ansible.executor.stats
import
AggregateStats
from
ansible.playbook.play_context
import
PlayContext
from
ansible.playbook.play_context
import
PlayContext
from
ansible.plugins
import
callback_loader
,
strategy_loader
from
ansible.plugins
import
callback_loader
,
strategy_loader
,
module_loader
from
ansible.template
import
Templar
from
ansible.template
import
Templar
__all__
=
[
'TaskQueueManager'
]
__all__
=
[
'TaskQueueManager'
]
...
@@ -62,6 +62,12 @@ class TaskQueueManager:
...
@@ -62,6 +62,12 @@ class TaskQueueManager:
self
.
_callbacks_loaded
=
False
self
.
_callbacks_loaded
=
False
self
.
_callback_plugins
=
[]
self
.
_callback_plugins
=
[]
# make sure the module path (if specified) is parsed and
# added to the module_loader object
if
options
.
module_path
is
not
None
:
for
path
in
options
.
module_path
.
split
(
os
.
pathsep
):
module_loader
.
add_directory
(
path
)
# a special flag to help us exit cleanly
# a special flag to help us exit cleanly
self
.
_terminated
=
False
self
.
_terminated
=
False
...
...
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