From f1fcab4610d518bf776ea2925113d928e97ca05f Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 1 Dec 2015 08:15:53 -0800 Subject: [PATCH] ignore password flags in become conflict check since all the --ask pass options end up triggering the same code and are functionally equivalent, ignore them when it comes to checking privilege escalation conflicts. This allows using -K when --become-method=su and so on. --- lib/ansible/cli/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index 012872be7c..76bbc6b8a8 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -191,12 +191,9 @@ class CLI(object): if runas_opts: # Check for privilege escalation conflicts - if (op.su or op.su_user or op.ask_su_pass) and \ - (op.sudo or op.sudo_user or op.ask_sudo_pass) or \ - (op.su or op.su_user or op.ask_su_pass) and \ - (op.become or op.become_user or op.become_ask_pass) or \ - (op.sudo or op.sudo_user or op.ask_sudo_pass) and \ - (op.become or op.become_user or op.become_ask_pass): + if (op.su or op.su_user) and (op.sudo or op.sudo_user) or \ + (op.su or op.su_user) and (op.become or op.become_user) or \ + (op.sudo or op.sudo_user) and (op.become or op.become_user): self.parser.error("Sudo arguments ('--sudo', '--sudo-user', and '--ask-sudo-pass') " "and su arguments ('-su', '--su-user', and '--ask-su-pass') "