1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Move conditional that accounts for variances in distros/versions to work when removing and adding.

This commit is contained in:
Matt Wright 2012-08-30 12:35:37 -04:00
parent 00c4c5c4a1
commit bdfccbfb34

View file

@ -39,6 +39,8 @@ def _find_binary(module):
'%s' % binaries) '%s' % binaries)
def _run(cmd): 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 # returns (rc, stdout, stderr) from shell command
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True) stderr=subprocess.PIPE, shell=True)
@ -72,9 +74,6 @@ def main():
cmd = '%s "%s"' % (add_apt_repository, repo) 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) rc, out, err = _run(cmd)
changed = rc == 0 and not existed changed = rc == 0 and not existed