-
Notifications
You must be signed in to change notification settings - Fork 9
v2.1 Add ability to version installations of docker-ce and docker-ce-cli #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,23 @@ | |||||||||||||
| from pyinfra.operations import apt, dnf, files, yum | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def _apt_install(): | ||||||||||||||
| def get_pkgs_to_install(version): | ||||||||||||||
| docker_packages = [ | ||||||||||||||
| "docker-ce", | ||||||||||||||
| "docker-ce-cli" | ||||||||||||||
| ] | ||||||||||||||
| if not version: | ||||||||||||||
| return docker_packages | ||||||||||||||
|
|
||||||||||||||
| versioned_packages = [] | ||||||||||||||
| for pkg in docker_packages: | ||||||||||||||
| versioned_packages.append(f"{pkg}={version}") | ||||||||||||||
|
|
||||||||||||||
| return versioned_packages | ||||||||||||||
|
||||||||||||||
| versioned_packages = [] | |
| for pkg in docker_packages: | |
| versioned_packages.append(f"{pkg}={version}") | |
| return versioned_packages | |
| return [f"{pkg}={version}" for pkg in docker_packages] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making version a host data, maybe with default, instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to force the default to be an older package version for now, while it's having issues for us it might be very swiftly patched and anyone using this will be getting an older package 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default could be None and the same logic then applies. It would remove the need to pass the version through the functions.
I'm not sure this is the best coding practice (prefer dependency injection over global variables) but it seems to me it would be more in line with the spirit of pyinfra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh I see your point!
ca64934
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the best coding practice (prefer dependency injection over global variables) but it seems to me it would be more in line with the spirit of pyinfra.
heh, totally agree with this, the deploy data defaults thing is... not great. But absolutely right thing to do here now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth adding a flag to choose whether to install the CLI package, defaulting to False since this was the behaviour before this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think about this but that's not true,
docker-ce-cliis a dependancy ofdocker-cebut it looks like docker isn't dependancy managing correctly asdocker-cebreaks withdocker-ce-cli=>23.0(from the testing I've done). But just pinningdocker-ceinstalls23.0for the cli.There are other dependancies which didn't give any problems but follow a different versioning so shouldn't be tied to this.
docker-ce-rootless-extrasseems to follow the same versioning and is part of thedocker-ceecosystem so it might make sense to pin that one as well...