From c4303c8c04dd14df8d710fe8279e5f746d974ecf Mon Sep 17 00:00:00 2001 From: Ludovic Claude Date: Wed, 18 Jul 2012 12:05:12 +0200 Subject: [PATCH 1/3] Avoid spurious error when mixing a local play with remote plays depending on --ask-sudo-pass --- lib/ansible/runner/connection/local.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/connection/local.py b/lib/ansible/runner/connection/local.py index 7bde31c916..1779ffb45c 100644 --- a/lib/ansible/runner/connection/local.py +++ b/lib/ansible/runner/connection/local.py @@ -37,12 +37,12 @@ class LocalConnection(object): ''' run a command on the local host ''' if self.runner.sudo and sudoable: + if self.runner.sudo_pass: + # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome + # to do so. The primary usage of the local connection is for crontab and kickstart usage however + # so this doesn't seem to be a huge priority + raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") cmd = "sudo -s %s" % cmd - if self.runner.sudo_pass: - # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome - # to do so. The primary usage of the local connection is for crontab and kickstart usage however - # so this doesn't seem to be a huge priority - raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") p = subprocess.Popen(cmd, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) From 0d53b1b0973076e009630f2d8fecb55758d3dbc8 Mon Sep 17 00:00:00 2001 From: Ludovic Claude Date: Wed, 18 Jul 2012 17:52:51 +0200 Subject: [PATCH 2/3] Change previous fix to a one line change relative to upstream --- lib/ansible/runner/connection/local.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/connection/local.py b/lib/ansible/runner/connection/local.py index 1779ffb45c..582059036f 100644 --- a/lib/ansible/runner/connection/local.py +++ b/lib/ansible/runner/connection/local.py @@ -37,12 +37,12 @@ class LocalConnection(object): ''' run a command on the local host ''' if self.runner.sudo and sudoable: - if self.runner.sudo_pass: - # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome - # to do so. The primary usage of the local connection is for crontab and kickstart usage however - # so this doesn't seem to be a huge priority - raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") cmd = "sudo -s %s" % cmd + if self.runner.sudo and sudoable and self.runner.sudo_pass: + # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome + # to do so. The primary usage of the local connection is for crontab and kickstart usage however + # so this doesn't seem to be a huge priority + raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") p = subprocess.Popen(cmd, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) From 26dc607c5c4ec29a6c83911299b10558dddc4f3a Mon Sep 17 00:00:00 2001 From: Ludovic Claude Date: Wed, 18 Jul 2012 19:02:56 +0200 Subject: [PATCH 3/3] Revert "Change previous fix to a one line change relative to upstream" This reverts commit 0d53b1b0973076e009630f2d8fecb55758d3dbc8. --- lib/ansible/runner/connection/local.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/connection/local.py b/lib/ansible/runner/connection/local.py index 582059036f..1779ffb45c 100644 --- a/lib/ansible/runner/connection/local.py +++ b/lib/ansible/runner/connection/local.py @@ -37,12 +37,12 @@ class LocalConnection(object): ''' run a command on the local host ''' if self.runner.sudo and sudoable: + if self.runner.sudo_pass: + # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome + # to do so. The primary usage of the local connection is for crontab and kickstart usage however + # so this doesn't seem to be a huge priority + raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") cmd = "sudo -s %s" % cmd - if self.runner.sudo and sudoable and self.runner.sudo_pass: - # NOTE: if someone wants to add sudo w/ password to the local connection type, they are welcome - # to do so. The primary usage of the local connection is for crontab and kickstart usage however - # so this doesn't seem to be a huge priority - raise errors.AnsibleError("sudo with password is presently only supported on the paramiko (SSH) connection type") p = subprocess.Popen(cmd, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE)