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
9b61cf58
Commit
9b61cf58
authored
Aug 16, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented async tasks in adhoc v2
parent
43bf9c86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
+4
-14
lib/ansible/cli/__init__.py
+1
-2
lib/ansible/cli/adhoc.py
+3
-12
No files found.
lib/ansible/cli/__init__.py
View file @
9b61cf58
...
...
@@ -308,8 +308,7 @@ class CLI(object):
help
=
"override the connection timeout in seconds (default=
%
s)"
%
C
.
DEFAULT_TIMEOUT
)
if
async_opts
:
parser
.
add_option
(
'-P'
,
'--poll'
,
default
=
C
.
DEFAULT_POLL_INTERVAL
,
type
=
'int'
,
dest
=
'poll_interval'
,
parser
.
add_option
(
'-P'
,
'--poll'
,
default
=
C
.
DEFAULT_POLL_INTERVAL
,
type
=
'int'
,
dest
=
'poll_interval'
,
help
=
"set the poll interval if using -B (default=
%
s)"
%
C
.
DEFAULT_POLL_INTERVAL
)
parser
.
add_option
(
'-B'
,
'--background'
,
dest
=
'seconds'
,
type
=
'int'
,
default
=
0
,
help
=
'run asynchronously, failing after X seconds (default=N/A)'
)
...
...
lib/ansible/cli/adhoc.py
View file @
9b61cf58
...
...
@@ -64,12 +64,12 @@ class AdHocCLI(CLI):
return
True
def
_play_ds
(
self
,
pattern
):
def
_play_ds
(
self
,
pattern
,
async
,
poll
):
return
dict
(
name
=
"Ansible Ad-Hoc"
,
hosts
=
pattern
,
gather_facts
=
'no'
,
tasks
=
[
dict
(
action
=
dict
(
module
=
self
.
options
.
module_name
,
args
=
parse_kv
(
self
.
options
.
module_args
))
),
]
tasks
=
[
dict
(
action
=
dict
(
module
=
self
.
options
.
module_name
,
args
=
parse_kv
(
self
.
options
.
module_args
))
,
async
=
async
,
poll
=
poll
)
]
)
def
run
(
self
):
...
...
@@ -122,16 +122,7 @@ class AdHocCLI(CLI):
err
=
err
+
' (did you mean to run ansible-playbook?)'
raise
AnsibleOptionsError
(
err
)
#TODO: implement async support
#if self.options.seconds:
# callbacks.display("background launch...\n\n", color='cyan')
# results, poller = runner.run_async(self.options.seconds)
# results = self.poll_while_needed(poller)
#else:
# results = runner.run()
# create a pseudo-play to execute the specified module via a single task
play_ds
=
self
.
_play_ds
(
pattern
)
play_ds
=
self
.
_play_ds
(
pattern
,
self
.
options
.
seconds
,
self
.
options
.
poll_interval
)
play
=
Play
()
.
load
(
play_ds
,
variable_manager
=
variable_manager
,
loader
=
loader
)
if
self
.
options
.
one_line
:
...
...
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