From bdfccbfb340e3fda5fbf74ce8a9762e96c512ff7 Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Thu, 30 Aug 2012 12:35:37 -0400 Subject: [PATCH] Move conditional that accounts for variances in distros/versions to work when removing and adding. --- library/apt_repository | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/apt_repository b/library/apt_repository index 8724f7c301..3815937f81 100755 --- a/library/apt_repository +++ b/library/apt_repository @@ -39,6 +39,8 @@ def _find_binary(module): '%s' % binaries) def _run(cmd): + if platform.dist()[0] == 'debian' or float(platform.dist()[1]) >= 11.10: + cmd = cmd + ' -y' # returns (rc, stdout, stderr) from shell command process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) @@ -72,9 +74,6 @@ def main(): cmd = '%s "%s"' % (add_apt_repository, repo) - if platform.dist()[0] == 'debian' or float(platform.dist()[1]) >= 11.10: - cmd = cmd + ' -y' - rc, out, err = _run(cmd) changed = rc == 0 and not existed