Skip to content

Commit

Permalink
devonfw#875: fix lazydocker (devonfw#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Dec 12, 2024
1 parent 7866298 commit 75f5043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/879[#879]: cannot omit default settings URL in ide create
* https://github.com/devonfw/IDEasy/issues/758[#758]: Create status commandlet
* https://github.com/devonfw/IDEasy/issues/824[#824]: ide create «settings-url»#«branch» not working
* https://github.com/devonfw/IDEasy/issues/875[#875]: lazydocker is not working
* https://github.com/devonfw/IDEasy/issues/754[#754]: Again messages break processable command output
* https://github.com/devonfw/IDEasy/issues/737[#739]: Improved error handling to show 'You are not inside an IDE installation' only when relevant.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ protected void installDependencies() {
// TODO create lazydocker/lazydocker/dependencies.json file in ide-urls and delete this method
getCommandlet(Docker.class).install();
// verify docker API version requirements
String bashPath = this.context.findBashRequired();
ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable(bashPath)
.addArg("-c").addArg("docker").addArg("version").addArg("--format").addArg("'{{.Client.APIVersion}}'");
ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker")
.addArg("version").addArg("--format").addArg("'{{.Client.APIVersion}}'");
ProcessResult result = pc.run(ProcessMode.DEFAULT_CAPTURE);
verifyDockerVersion(result, MIN_API_VERSION, "docker API");

// verify docker compose version requirements
pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable(bashPath).addArg("-c").addArg("docker-compose").addArg("version")
pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker-compose").addArg("version")
.addArg("--short");
result = pc.run(ProcessMode.DEFAULT_CAPTURE);
verifyDockerVersion(result, MIN_COMPOSE_VERSION, "docker-compose");
Expand All @@ -54,7 +53,7 @@ protected void installDependencies() {
private static void verifyDockerVersion(ProcessResult result, VersionIdentifier minimumVersion, String kind) {
// we have this pattern a lot that we want to get a single line output of a successful ProcessResult.
// we should create a generic method in ProcessResult for this use-case.
if (!result.isSuccessful() || result.getOut().isEmpty()) {
if (result.getOut().isEmpty()) {
throw new CliException("Docker is not installed, but required for lazydocker.\n" //
+ "To install docker, call the following command:\n" //
+ "ide install docker");
Expand Down

0 comments on commit 75f5043

Please sign in to comment.