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
19e87420
Commit
19e87420
authored
Jan 23, 2014
by
jctanner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5713 from angstwad/su-fix
Disallow su and sudo params in same play/task
parents
86ba8f4d
01d1bd61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
lib/ansible/playbook/play.py
+5
-0
lib/ansible/playbook/task.py
+7
-0
No files found.
lib/ansible/playbook/play.py
View file @
19e87420
...
...
@@ -125,6 +125,11 @@ class Play(object):
self
.
su
=
ds
.
get
(
'su'
,
self
.
playbook
.
su
)
self
.
su_user
=
ds
.
get
(
'su_user'
,
self
.
playbook
.
su_user
)
# Fail out if user specifies a sudo param with a su param in a given play
if
(
ds
.
get
(
'sudo'
)
or
ds
.
get
(
'sudo_user'
))
and
(
ds
.
get
(
'su'
)
or
ds
.
get
(
'su_user'
)):
raise
errors
.
AnsibleError
(
'sudo params ("sudo", "sudo_user") and su params '
'("su", "su_user") cannot be used together'
)
load_vars
=
{}
load_vars
[
'playbook_dir'
]
=
self
.
basedir
if
self
.
playbook
.
inventory
.
basedir
()
is
not
None
:
...
...
lib/ansible/playbook/task.py
View file @
19e87420
...
...
@@ -157,6 +157,13 @@ class Task(object):
self
.
su_user
=
ds
.
get
(
'su_user'
,
play
.
su_user
)
self
.
su_pass
=
ds
.
get
(
'su_pass'
,
play
.
playbook
.
su_pass
)
# Fail out if user specifies a sudo param with a su param in a given play
if
(
ds
.
get
(
'sudo'
)
or
ds
.
get
(
'sudo_user'
)
or
ds
.
get
(
'sudo_pass'
))
and
\
(
ds
.
get
(
'su'
)
or
ds
.
get
(
'su_user'
)
or
ds
.
get
(
'su_pass'
)):
raise
errors
.
AnsibleError
(
'sudo params ("sudo", "sudo_user", "sudo_pass") '
'and su params "su", "su_user", "su_pass") '
'cannot be used together'
)
# Both are defined
if
(
'action'
in
ds
)
and
(
'local_action'
in
ds
):
raise
errors
.
AnsibleError
(
"the 'action' and 'local_action' attributes can not be used together"
)
...
...
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