From 37ee361be19f30511832e1191eeb3de883eae0ca Mon Sep 17 00:00:00 2001 From: Ton Kersten Date: Fri, 5 Jul 2013 19:10:36 +0200 Subject: [PATCH] Repair issue #3447 --- lib/ansible/constants.py | 1 + lib/ansible/utils/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 3351c6f661..c729272c14 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -109,6 +109,7 @@ DEFAULT_SCP_IF_SSH = get_config(p, 'ssh_connection', 'scp_if_ssh', DEFAULT_MANAGED_STR = get_config(p, DEFAULTS, 'ansible_managed', None, 'Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}') DEFAULT_SYSLOG_FACILITY = get_config(p, DEFAULTS, 'syslog_facility', 'ANSIBLE_SYSLOG_FACILITY', 'LOG_USER') DEFAULT_KEEP_REMOTE_FILES = get_config(p, DEFAULTS, 'keep_remote_files', 'ANSIBLE_KEEP_REMOTE_FILES', '0') +DEFAULT_SUDO = get_config(p, DEFAULTS, 'sudo', 'ANSIBLE_SUDO', False, boolean=True) DEFAULT_SUDO_EXE = get_config(p, DEFAULTS, 'sudo_exe', 'ANSIBLE_SUDO_EXE', 'sudo') DEFAULT_SUDO_FLAGS = get_config(p, DEFAULTS, 'sudo_flags', 'ANSIBLE_SUDO_FLAGS', '-H') DEFAULT_HASH_BEHAVIOUR = get_config(p, DEFAULTS, 'hash_behaviour', 'ANSIBLE_HASH_BEHAVIOUR', 'replace') diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 192b1c0edb..a5046e12b2 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -490,7 +490,7 @@ def base_parser(constants=C, usage="", output_opts=False, runas_opts=False, help='log output to this directory') if runas_opts: - parser.add_option("-s", "--sudo", default=False, action="store_true", + parser.add_option("-s", "--sudo", default=constants.DEFAULT_SUDO, action="store_true", dest='sudo', help="run operations with sudo (nopasswd)") parser.add_option('-U', '--sudo-user', dest='sudo_user', help='desired sudo user (default=root)', default=None) # Can't default to root because we need to detect when this option was given