diff options
author | Paul Durivage <pauldurivage@gmail.com> | 2013-12-19 15:12:12 -0600 |
---|---|---|
committer | Paul Durivage <pauldurivage@gmail.com> | 2014-01-20 11:25:10 -0600 |
commit | c95be4ceaa784f0c16d3a9a4ae9342c50c411eac (patch) | |
tree | 087d03f3085b4fe1d7b92e822ea063ae9e052ecb /bin | |
parent | 4088243debb24388b4e8952756fb1b13a4e39598 (diff) | |
download | ansible-c95be4ceaa784f0c16d3a9a4ae9342c50c411eac.tar.gz |
Make sudo and su command line arguments mutually exclusive
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ansible | 8 | ||||
-rwxr-xr-x | bin/ansible-playbook | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/bin/ansible b/bin/ansible index 84776c5a6d..a0464c142a 100755 --- a/bin/ansible +++ b/bin/ansible @@ -67,6 +67,14 @@ class Cli(object): if len(args) == 0 or len(args) > 1: parser.print_help() sys.exit(1) + + # su and sudo command line arguments need to be mutually exclusive + if (options.su or options.su_user or options.ask_su_pass) and \ + (options.sudo or options.sudo_user or options.ask_sudo_pass): + parser.error("Sudo arguments ('--sudo', '--sudo-user', and '--ask-sudo-pass') " + "and su arguments ('-su', '--su-user', and '--ask-su-pass') are " + "mutually exclusive") + return (options, args) # ---------------------------------------------- diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 4f8934ebb5..646b64a764 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -83,6 +83,13 @@ def main(args): parser.print_help(file=sys.stderr) return 1 + # su and sudo command line arguments need to be mutually exclusive + if (options.su or options.su_user or options.ask_su_pass) and \ + (options.sudo or options.sudo_user or options.ask_sudo_pass): + parser.error("Sudo arguments ('--sudo', '--sudo-user', and '--ask-sudo-pass') " + "and su arguments ('-su', '--su-user', and '--ask-su-pass') are " + "mutually exclusive") + inventory = ansible.inventory.Inventory(options.inventory) inventory.subset(options.subset) if len(inventory.list_hosts()) == 0: |