Skip to content

Commit e869597

Browse files
Ryan McCorryFizzadar
authored andcommitted
Specify version operation for apt/yum
1 parent ca61c06 commit e869597

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pyinfra_docker/docker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717

1818

19-
def get_pkgs_to_install():
19+
def get_pkgs_to_install(operator):
2020
docker_packages = [
2121
"docker-ce",
2222
"docker-ce-cli",
@@ -25,7 +25,7 @@ def get_pkgs_to_install():
2525
if not host.data.docker_version:
2626
return docker_packages
2727

28-
return [f"{pkg}={host.data.docker_version}" for pkg in docker_packages]
28+
return [f"{pkg}{operator}{host.data.docker_version}" for pkg in docker_packages]
2929

3030

3131

@@ -93,10 +93,11 @@ def deploy_docker(config=None):
9393
config: filename or dict of JSON data
9494
"""
9595

96-
packages = get_pkgs_to_install()
9796
if host.get_fact(DebPackages):
97+
packages = get_pkgs_to_install('=')
9898
_apt_install(packages)
9999
elif host.get_fact(RpmPackages):
100+
packages = get_pkgs_to_install('-')
100101
_yum_or_dnf_install(
101102
dnf if host.get_fact(Which, command="dnf") else yum,
102103
packages,

0 commit comments

Comments
 (0)