Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
1b090a6c
Commit
1b090a6c
authored
Feb 27, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ansible: fix become:true with sudo:true
parent
83f28624
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
ansible_mitogen/connection/mitogen.py
ansible_mitogen/connection/mitogen.py
+7
-3
examples/playbook/ansible.cfg
examples/playbook/ansible.cfg
+0
-1
No files found.
ansible_mitogen/connection/mitogen.py
View file @
1b090a6c
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
from
__future__
import
absolute_import
from
__future__
import
absolute_import
import
logging
import
logging
import
os
import
os
import
sys
import
time
import
time
import
ansible.errors
import
ansible.errors
...
@@ -105,7 +106,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
...
@@ -105,7 +106,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
})
})
)
)
def
_connect_sudo
(
self
,
via
):
def
_connect_sudo
(
self
,
via
=
None
,
python_path
=
None
):
"""
"""
Fetch a reference to a sudo Context matching the play context from
Fetch a reference to a sudo Context matching the play context from
ContextService in the master process.
ContextService in the master process.
...
@@ -118,7 +119,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
...
@@ -118,7 +119,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
'method'
:
'sudo'
,
'method'
:
'sudo'
,
'username'
:
self
.
_play_context
.
become_user
,
'username'
:
self
.
_play_context
.
become_user
,
'password'
:
self
.
_play_context
.
password
,
'password'
:
self
.
_play_context
.
password
,
'python_path'
:
'/usr/bin/python'
,
'python_path'
:
python_path
or
'/usr/bin/python'
,
'via'
:
via
,
'via'
:
via
,
}))
}))
...
@@ -140,7 +141,10 @@ class Connection(ansible.plugins.connection.ConnectionBase):
...
@@ -140,7 +141,10 @@ class Connection(ansible.plugins.connection.ConnectionBase):
self
.
router
,
self
.
parent
=
mitogen
.
unix
.
connect
(
path
)
self
.
router
,
self
.
parent
=
mitogen
.
unix
.
connect
(
path
)
if
self
.
original_transport
==
'local'
:
if
self
.
original_transport
==
'local'
:
self
.
context
=
self
.
_connect_local
()
if
not
self
.
_play_context
.
become
:
self
.
context
=
self
.
_connect_local
()
else
:
self
.
context
=
self
.
_connect_sudo
(
python_path
=
sys
.
executable
)
else
:
else
:
self
.
host
=
self
.
_connect_ssh
()
self
.
host
=
self
.
_connect_ssh
()
if
not
self
.
_play_context
.
become
:
if
not
self
.
_play_context
.
become
:
...
...
examples/playbook/ansible.cfg
View file @
1b090a6c
[defaults]
[defaults]
inventory = hosts
inventory = hosts
strategy_plugins = ../../ansible_mitogen/strategy
strategy_plugins = ../../ansible_mitogen/strategy
strategy = mitogen
retry_files_enabled = False
retry_files_enabled = False
[ssh_connection]
[ssh_connection]
...
...
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